<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[RYUSLOG DEV]]></title><description><![CDATA[RYUSLOG DEV]]></description><link>https://ryuslog.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Fri, 20 Nov 2026 18:50:57 GMT</lastBuildDate><atom:link href="https://ryuslog.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Supabase 42501: new row violates row-level security policy]]></title><description><![CDATA[Why Supabase returns 42501 new row violates row-level security policy, and the INSERT policy with WITH CHECK that actually allows the write.]]></description><link>https://ryuslog.hashnode.dev/supabase-42501-new-row-violates-row-level-security-policy</link><guid isPermaLink="true">https://ryuslog.hashnode.dev/supabase-42501-new-row-violates-row-level-security-policy</guid><category><![CDATA[supabase]]></category><category><![CDATA[postgres]]></category><dc:creator><![CDATA[R (RYUSLOG DEV)]]></dc:creator><pubDate>Fri, 20 Nov 2026 04:53:37 GMT</pubDate><content:encoded><![CDATA[<h2>What the error actually says</h2>
<p><code>new row violates row-level security policy for table "posts"</code> (SQLSTATE 42501) is not a permissions problem in the usual sense. RLS is on, the statement ran, and no policy allowed that row to be written. Postgres evaluates the row-side expression of a matching policy against the row you are writing and reports 42501 when none passes.</p>
<p>Four causes, in order of how often I meet them:</p>
<ol>
<li>No INSERT policy at all. <code>enable row level security</code> with only a SELECT policy blocks every insert.</li>
<li>A policy exists but has no <code>WITH CHECK</code>. For INSERT the row-side expression is <code>WITH CHECK</code>; a policy written with only <code>USING</code> has nothing to validate on a new row.</li>
<li>Type or column mismatch: comparing <code>auth.uid()</code> (uuid) with a <code>text</code> column, or a column that the client never sends, so the check is never true.</li>
<li>The client is not authenticated: <code>auth.uid()</code> is NULL and <code>user_id = auth.uid()</code> evaluates to NULL.</li>
</ol>
<h2>The minimal correct policy</h2>
<pre><code class="language-sql">alter table public.posts enable row level security;

create policy "insert own posts"
on public.posts
for insert
to authenticated
with check (user_id = auth.uid());
</code></pre>
<p>Two details worth keeping:</p>
<ul>
<li><code>to authenticated</code> matters. Without it the policy also applies to <code>anon</code>, where <code>auth.uid()</code> is NULL.</li>
<li>For UPDATE you need both halves: <code>using (...)</code> selects the rows you may touch, <code>with check (...)</code> constrains what the row may look like afterwards. A missing <code>with check</code> lets a client move a row to another user.</li>
</ul>
<h2>Two traps that look like other bugs</h2>
<ul>
<li><code>insert(...).select()</code> returning an empty array: the insert worked, but <code>INSERT ... RETURNING</code> also needs a SELECT policy. Without one the returning row is filtered out.</li>
<li>Service role keys and the SQL editor bypass RLS. A statement that succeeds there proves nothing about the browser client.</li>
</ul>
<h2>Checking which policy failed</h2>
<pre><code class="language-sql">select polname, polcmd,
       pg_get_expr(polqual, polrelid) as using_expr,
       pg_get_expr(polwithcheck, polrelid) as check_expr
from pg_policy
where polrelid = 'public.posts'::regclass;
</code></pre>
<p>A null <code>check_expr</code> on an INSERT policy is the bug. <code>polcmd</code> says which command it covers (<code>a</code> insert, <code>r</code> select, <code>w</code> update, <code>d</code> delete).</p>
<h2>False leads</h2>
<ul>
<li><code>grant insert on public.posts to authenticated</code>: grants and policies are separate layers; both must pass, and a missing policy still fails with 42501.</li>
<li>Disabling RLS to "test": it hides which policy failed and is easy to forget.</li>
<li>Comparing <code>auth.uid()</code> to a <code>text</code> column left over from an earlier migration.</li>
</ul>
<p>The longer version, with the full Supabase diagnosis path, is on ryuslog.com.</p>
]]></content:encoded></item><item><title><![CDATA[ModuleNotFoundError: No module named 'app' — what sys.path actually contains]]></title><description><![CDATA[sys.path[0] is the script's folder, not the project root. Why No module named 'app' happens, and the editable install, Docker and pytest fixes.]]></description><link>https://ryuslog.hashnode.dev/modulenotfounderror-no-module-named-app-what-sys-path-actually-contains</link><guid isPermaLink="true">https://ryuslog.hashnode.dev/modulenotfounderror-no-module-named-app-what-sys-path-actually-contains</guid><category><![CDATA[Python]]></category><category><![CDATA[debugging]]></category><category><![CDATA[Programming Tips]]></category><dc:creator><![CDATA[R (RYUSLOG DEV)]]></dc:creator><pubDate>Thu, 19 Nov 2026 14:27:42 GMT</pubDate><content:encoded><![CDATA[<p>An import that works in the REPL fails from the script, or the other way round:</p>
<pre><code>$ python app/main.py
Traceback (most recent call last):
  File "/srv/app/app/main.py", line 3, in &lt;module&gt;
    from app.services import orders
ModuleNotFoundError: No module named 'app'
</code></pre>
<p>The package exists. The file exists. <code>pip show</code> says the dependency is installed. The import still fails because <code>sys.path</code> in that process does not contain the directory that makes the name resolvable — and the directory Python chooses for <code>sys.path[0]</code> is the one people get wrong.</p>
<h2>What <code>sys.path[0]</code> actually is</h2>
<p>Python resolves an absolute import by walking <code>sys.path</code> in order. For a script, the first entry is <strong>the directory of the script being run</strong>. Not the current working directory, not the project root.</p>
<p>So <code>python app/main.py</code> puts <code>/srv/app/app</code> first, and <code>app.services</code> is looked up inside <code>/srv/app/app/app</code>, which does not exist. Run the same code as a module and the first entry becomes the working directory:</p>
<pre><code class="language-bash">python app/main.py      # ModuleNotFoundError: No module named 'app'
python -m app.main      # works
</code></pre>
<p>The rest of the list follows: <code>PYTHONPATH</code>, the standard library from <code>sys.prefix</code>, then <code>site-packages</code> for each site directory. Print it in the failing process, never in your terminal:</p>
<pre><code class="language-bash">python -c "import sys, site; print(sys.executable); print(*sys.path, sep='\n')"
python -c "import importlib.util as u; print(u.find_spec('app'))"
</code></pre>
<p><code>find_spec('app')</code> returning <code>None</code> means no entry on that path holds <code>app/</code> or <code>app.py</code>. Returning a spec whose <code>origin</code> lives in <code>site-packages</code> means a <strong>different</strong> copy of the package was found, usually a stale one installed with <code>pip install .</code> instead of <code>pip install -e .</code>.</p>
<h2>One decisive check per failure mode</h2>
<table>
<thead>
<tr>
<th>Observation</th>
<th>Root cause</th>
<th>Fix</th>
</tr>
</thead>
<tbody><tr>
<td>Works with <code>-m</code>, fails with a script path</td>
<td><code>sys.path[0]</code> is the script's directory</td>
<td>Run as a module, or put the root on <code>PYTHONPATH</code></td>
</tr>
<tr>
<td>Works in the REPL, fails as a service</td>
<td>Different interpreter or virtualenv</td>
<td>Start it with the venv's <code>python</code> explicitly</td>
</tr>
<tr>
<td><code>find_spec</code> points into <code>site-packages</code></td>
<td>A copy was installed; source edits are ignored</td>
<td><code>pip install -e .</code>, remove the stale copy</td>
</tr>
<tr>
<td>Fails only in Docker</td>
<td><code>WORKDIR</code> or <code>COPY</code> misses the package root</td>
<td>Copy the root, set <code>WORKDIR</code> there</td>
</tr>
<tr>
<td>Fails only under pytest</td>
<td>pytest's <code>rootdir</code> and import mode differ</td>
<td><code>pythonpath</code> in pytest config, or a <code>src</code> layout</td>
</tr>
<tr>
<td>Fails for one module name only</td>
<td>A local file shadows the dependency</td>
<td>Rename it and clear <code>__pycache__</code></td>
</tr>
<tr>
<td>Fails only after packaging</td>
<td>The subpackage was not declared</td>
<td>Declare packages in <code>pyproject.toml</code></td>
</tr>
</tbody></table>
<h2>Fix 1: run it as a module</h2>
<p>The cheapest fix, and the one that keeps the layout honest, is to invoke the entry point as a module from the project root:</p>
<pre><code class="language-bash">cd /srv/app
python -m app.main
</code></pre>
<p>Every server invocation already assumes this. <code>gunicorn app.main:app</code>, <code>uvicorn app.main:app</code> and <code>celery -A app.worker</code> import the target by name and need the project root on the path — so start them from the directory that contains <code>app/</code>. A systemd unit with a different <code>WorkingDirectory</code> is enough to break this after a deploy that changed nothing else.</p>
<h2>Fix 2: install the package, not a path hack</h2>
<p><code>pip install -e .</code> adds a link into <code>site-packages</code> that points at your source tree, so <code>import app</code> works from any directory inside that environment and edits take effect without reinstalling. A <code>src/</code> layout makes this the only way imports can succeed:</p>
<pre><code class="language-toml">[project]
name = "demo"
version = "0.1.0"

[tool.setuptools.packages.find]
where = ["src"]
</code></pre>
<p><code>sys.path.append(...)</code> at the top of the failing file is the fix that keeps costing: it repairs one entry point and leaves every other process, test runner and task worker broken.</p>
<h2>The Docker variant</h2>
<p>Containers reproduce this error whenever the package root is not the working directory or was never copied in:</p>
<pre><code class="language-dockerfile">WORKDIR /srv/app
COPY pyproject.toml ./
RUN pip install --no-cache-dir -e .
COPY app ./app
CMD ["python", "-m", "app.main"]
</code></pre>
<p><code>COPY app ./app</code> keeps the image small, but a <code>pyproject.toml</code> that expects <code>src/</code> then breaks. Check the built image before debugging the app:</p>
<pre><code class="language-bash">docker run --rm image python -c "import app; print(app.__file__)"
</code></pre>
<h2>Packaging: the wheel that is missing a directory</h2>
<p>Python 3 treats a directory without <code>__init__.py</code> as a namespace package, so <code>import app</code> can succeed while <code>from app.services import orders</code> fails when <code>services</code> was excluded from the wheel. Packaging tools copy only declared packages:</p>
<pre><code class="language-toml">[tool.setuptools.packages.find]
include = ["app*"]
</code></pre>
<p>Verify the artefact rather than the source tree:</p>
<pre><code class="language-bash">python -m build &amp;&amp; unzip -l dist/*.whl | grep services
</code></pre>
<p>A wheel missing a subpackage installs cleanly and fails at import time, which is the standard cause of "works locally, fails in production".</p>
<h2>Shadowing, the sneaky one</h2>
<p>A file named <code>types.py</code>, <code>json.py</code>, <code>random.py</code> or <code>email.py</code> next to the entry point shadows the standard library or a dependency, and the error then names a module you definitely installed:</p>
<pre><code class="language-bash">python -c "import json; print(json.__file__)"
# /srv/app/json.py    &lt;- that is not the standard library
</code></pre>
<p>Rename the file, delete its <code>__pycache__</code> entry, and re-run. This one also appears as <code>AttributeError</code> or a missing function on a standard module, because the import resolved to your file instead.</p>
<h2>pytest</h2>
<p>pytest inserts a rootdir based on its own import mode. A test that imports <code>app.services</code> fails when pytest chose <code>tests/</code> as the root:</p>
<pre><code class="language-toml">[tool.pytest.ini_options]
pythonpath = ["."]
testpaths = ["tests"]
</code></pre>
<p><code>pythonpath</code> is a pytest 7+ option. On older versions, a <code>conftest.py</code> at the project root is enough — its presence puts that directory on <code>sys.path</code> — or set <code>PYTHONPATH=.</code> in the runner.</p>
<h2>Habits worth keeping</h2>
<ul>
<li>Check <code>sys.executable</code> in the failing process, not in the shell you activated the venv in.</li>
<li>Remember that <code>PYTHONPATH</code> is inherited by child processes; a leftover value from an old deploy can load a second copy of the package.</li>
<li>Treat a Python version upgrade as innocent until proven otherwise. Path resolution has not changed; a new interpreter without the package installed is the usual explanation.</li>
</ul>
<p>The full version of this debugging walkthrough, with a clean reproduction tree for each case, is on my site: <a href="https://www.ryuslog.com/blog/python-modulenotfounderror-no-module-named-sys-path-fix">ModuleNotFoundError: No module named 'app'</a>.</p>
<p>References: <a href="https://docs.python.org/3/reference/import.html">The Python import system</a>, <a href="https://docs.python.org/3/library/sys.html#sys.path">sys.path</a>.</p>
]]></content:encoded></item><item><title><![CDATA[Next.js missing-suspense-with-csr-bailout: useSearchParams fix]]></title><description><![CDATA[next build compiles, then fails while prerendering one route: Nothing is wrong with the type system or the imports. Next.js is telling you that a component…]]></description><link>https://ryuslog.hashnode.dev/next-js-missing-suspense-with-csr-bailout-usesearchparams-fix</link><guid isPermaLink="true">https://ryuslog.hashnode.dev/next-js-missing-suspense-with-csr-bailout-usesearchparams-fix</guid><category><![CDATA[Next.js]]></category><category><![CDATA[React]]></category><category><![CDATA[JavaScript]]></category><dc:creator><![CDATA[R (RYUSLOG DEV)]]></dc:creator><pubDate>Thu, 19 Nov 2026 03:25:17 GMT</pubDate><content:encoded><![CDATA[<p><code>next build</code> compiles, then fails while prerendering one route:</p>
<pre><code>⨯ useSearchParams() should be wrapped in a suspense boundary at page "/search".
Read more: https://nextjs.org/docs/messages/missing-suspense-with-csr-bailout
Error occurred prerendering page "/search".
Export encountered an error on /search/page: /search, exiting the build.
</code></pre>
<p>Nothing is wrong with the type system or the imports. Next.js is telling you that a component read request data during a static prerender.</p>
<h2>Why the boundary is mandatory</h2>
<p><code>useSearchParams()</code> returns request-dependent data. A static prerender has no request, so Next would render the component with empty params and bake that empty state into the HTML served to everyone. To prevent that, Next requires a Suspense boundary above the component: the fallback is what gets prerendered, and the real params are read on the client after hydration. Without the boundary the build stops — since Next 14 this is a build failure, not a warning.</p>
<p>The rule is short: request data must be inside a boundary, or outside the static render entirely.</p>
<h2>A five-file reproduction</h2>
<p>A server page renders a client component that reads the query string:</p>
<pre><code class="language-tsx">// app/search/page.tsx  (server component)
import SearchBox from "./search-box";

export default function SearchPage() {
  return &lt;SearchBox /&gt;;   // no Suspense -&gt; build error
}
</code></pre>
<pre><code class="language-tsx">// app/search/search-box.tsx  (client component)
"use client";
import { useSearchParams } from "next/navigation";

export default function SearchBox() {
  const params = useSearchParams();
  const q = params.get("q") ?? "";
  return &lt;input defaultValue={q} /&gt;;
}
</code></pre>
<pre><code class="language-bash">npx next build
# ⨯ useSearchParams() should be wrapped in a suspense boundary at page "/search".
</code></pre>
<h2>The minimal fix</h2>
<p>Put the boundary in the server component, above the client component, and give it a real fallback:</p>
<pre><code class="language-tsx">// app/search/page.tsx
import { Suspense } from "react";
import SearchBox from "./search-box";

export default function SearchPage() {
  return (
    &lt;Suspense fallback={&lt;input disabled placeholder="Loading search…" /&gt;}&gt;
      &lt;SearchBox /&gt;
    &lt;/Suspense&gt;
  );
}
</code></pre>
<p>The fallback is not cosmetic: it is the HTML that ships in the static shell and the first thing a visitor sees, so it should look like the control it replaces rather than a spinner that shifts the layout.</p>
<h2>The four ways out compared</h2>
<table>
<thead>
<tr>
<th>Option</th>
<th>Prerender</th>
<th>SEO</th>
<th>Data on first paint</th>
<th>Use for</th>
</tr>
</thead>
<tbody><tr>
<td><code>&lt;Suspense&gt;</code> boundary</td>
<td>yes, fallback</td>
<td>yes, fallback HTML</td>
<td>after hydration</td>
<td>shared pages with filters, tabs, pagination</td>
</tr>
<tr>
<td><code>export const dynamic = "force-dynamic"</code></td>
<td>no</td>
<td>yes, per request</td>
<td>yes</td>
<td>personal dashboards, anything behind auth</td>
</tr>
<tr>
<td>read <code>searchParams</code> on the server</td>
<td>yes</td>
<td>yes, real content</td>
<td>yes, in HTML</td>
<td>search results you want indexed</td>
</tr>
<tr>
<td><code>window.location</code> in <code>useEffect</code></td>
<td>yes</td>
<td>weak</td>
<td>only after mount</td>
<td>avoid — it duplicates the hook</td>
</tr>
</tbody></table>
<p><code>force-dynamic</code> also clears the error by removing the prerender, at the cost of rendering every request on the server. It is the right answer for a page that is personal and unindexable; it is the wrong answer for a public page you want crawled.</p>
<p>Where the error comes from depends on the router:</p>
<table>
<thead>
<tr>
<th>Router</th>
<th>File that triggers it</th>
<th>Boundary goes in</th>
</tr>
</thead>
<tbody><tr>
<td>App Router</td>
<td>any client component using <code>useSearchParams</code></td>
<td>the nearest server component above it</td>
</tr>
<tr>
<td>Pages Router</td>
<td>the page component itself</td>
<td>around that component in the same tree</td>
</tr>
<tr>
<td><code>output: "export"</code></td>
<td>any static route with the hook</td>
<td>Suspense only — <code>force-dynamic</code> is not allowed</td>
</tr>
</tbody></table>
<h2>If you want the query in the indexed HTML</h2>
<p>A Suspense boundary prerenders the fallback, so the crawler sees "Loading search…" and never the resolved results. When the query needs to be in the HTML, read <code>searchParams</code> in the server component instead of using the hook on the client:</p>
<pre><code class="language-tsx">// app/search/page.tsx
export default async function SearchPage({
  searchParams,
}: {
  searchParams: Promise&lt;{ q?: string }&gt;;
}) {
  const { q = "" } = await searchParams;
  return &lt;Results query={q} /&gt;;
}
</code></pre>
<p>In Next 15 and later <code>searchParams</code> is a Promise and must be awaited; passing it straight to a client component without awaiting is the next error you will hit. Reading it on the server also makes the route dynamic automatically, which is exactly what you want for a results page.</p>
<h2>The two mistakes that keep the error alive</h2>
<ul>
<li><strong>Putting the boundary inside the client component.</strong> The boundary has to be above the component that calls the hook, in a server component. A <code>&lt;Suspense&gt;</code> rendered by the same client component that reads the params does not help, because the read still happens during the prerender of that tree.</li>
<li><strong>Wrapping the wrong level.</strong> With a layout that renders <code>&lt;SearchBox /&gt;</code> and a page that does not, the boundary belongs in the layout. Any ancestor that is a server component works; the error names a file, but the fix is "the nearest server component above the hook", not literally that file.</li>
</ul>
<p>Both cases look fixed locally because <code>next dev</code> renders on demand and never prerenders. Run <code>next build</code> before believing it.</p>
<p>The longer version, with the Pages Router and static-export cases, is on my site: <a href="https://www.ryuslog.com/blog/nextjs-missing-suspense-with-csr-bailout-usesearchparams">Next.js missing-suspense-with-csr-bailout: useSearchParams fix</a>.</p>
]]></content:encoded></item><item><title><![CDATA[Supabase SSR on Next.js: Stale Sessions and Lock Timeouts]]></title><description><![CDATA[Fix Next.js App Router sessions on @supabase/ssr: async cookies, cookie writes that throw in renders, lost proxy refreshes, and lock timeouts.]]></description><link>https://ryuslog.hashnode.dev/supabase-ssr-on-next-js-stale-sessions-and-lock-timeouts</link><guid isPermaLink="true">https://ryuslog.hashnode.dev/supabase-ssr-on-next-js-stale-sessions-and-lock-timeouts</guid><category><![CDATA[Next.js]]></category><category><![CDATA[supabase]]></category><dc:creator><![CDATA[R (RYUSLOG DEV)]]></dc:creator><pubDate>Wed, 18 Nov 2026 15:19:06 GMT</pubDate><content:encoded><![CDATA[<p>Supabase SSR sessions break in three layers at once, and each layer hides the one below it.</p>
<p><strong>Symptom.</strong> A Next.js App Router app on <code>@supabase/ssr</code> behaves differently on every request. The user signs in, the dashboard renders their data, then one refresh later <code>supabase.auth.getUser()</code> returns <code>null</code> and the page redirects to <code>/login</code>. The terminal repeats <code>Error: Cookies can only be modified in a Server Action or Route Handler</code>, or the console shows <code>NavigatorLockAcquireTimeoutError: Acquiring an exclusive Navigator LockManager lock "lock:sb-&lt;ref&gt;-auth-token" immediately failed</code> while the session stops refreshing.</p>
<p><strong>Cause.</strong> Three mechanisms fail together. <code>createServerClient</code> needs a <code>getAll</code>/<code>setAll</code> adapter, and since Next.js 15 <code>cookies()</code> is async, so a synchronous adapter reads an empty store. A Server Component is a render, not a mutation, so <code>cookieStore.set()</code> throws there and a <code>try/catch</code> keeps the render alive while discarding the refreshed token. And the proxy refreshes the token onto the <strong>response</strong> while the route handler downstream reads the <strong>request</strong> cookies, so the two halves of one request disagree.</p>
<p><strong>Fix.</strong> Return the full cookie set from <code>getAll</code>, write it back only where writing is legal, and in the proxy copy every <code>setAll</code> cookie onto both the request and the response. Never build a second client inside one request: auth serialises refreshes through a lock, and two clients racing it is what times out.</p>
<h2>The server client and its cookie adapter</h2>
<p><code>@supabase/ssr</code> splits one logical client into a server shape with a cookie adapter and a browser shape that reads <code>document.cookie</code>. If the adapter is wrong the two disagree and the session appears to flip between signed-in and signed-out.</p>
<pre><code class="language-ts">// lib/supabase/server.ts — Next.js 15+/16, @supabase/ssr 0.5+
import { createServerClient } from "@supabase/ssr";
import { cookies } from "next/headers";

export async function createClient() {
  const cookieStore = await cookies();      // async since Next.js 15

  return createServerClient(
    process.env.NEXT_PUBLIC_SUPABASE_URL!,
    process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
    {
      cookies: {
        getAll: () =&gt; cookieStore.getAll(),   // must return every chunk
        setAll(cookiesToSet) {
          try {
            cookiesToSet.forEach(({ name, value, options }) =&gt;
              cookieStore.set(name, value, options),
            );
          } catch {
            // Server Component render: writes are illegal here.
            // The proxy is responsible for persisting the refresh.
          }
        },
      },
    },
  );
}
</code></pre>
<p>To reproduce: guard a page with <code>getUser()</code>, set the access token lifetime to 60 seconds, wait past expiry, reload twice. The first request returns the user because <code>getUser()</code> refreshes in memory; the second returns <code>null</code> because the new token went to a cookie store that no longer exists. The proxy is what makes the refresh persist. In Next.js 16 the convention is <code>proxy.ts</code> with an exported <code>proxy</code> function; <code>middleware.ts</code> still loads but is deprecated, and <code>runtime</code> cannot be configured because proxy always runs on Node.js.</p>
<pre><code class="language-ts">// proxy.ts
import { createServerClient } from "@supabase/ssr";
import { NextResponse, type NextRequest } from "next/server";

export async function proxy(request: NextRequest) {
  let response = NextResponse.next({ request });

  const supabase = createServerClient(
    process.env.NEXT_PUBLIC_SUPABASE_URL!,
    process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
    {
      cookies: {
        getAll: () =&gt; request.cookies.getAll(),
        setAll(cookiesToSet) {
          cookiesToSet.forEach(({ name, value }) =&gt;
            request.cookies.set(name, value),           // downstream reads
          );
          response = NextResponse.next({ request });
          cookiesToSet.forEach(({ name, value, options }) =&gt;
            response.cookies.set(name, value, options),  // browser receives
          );
        },
      },
    },
  );

  const { data: { user } } = await supabase.auth.getUser();  // forces refresh

  if (!user &amp;&amp; request.nextUrl.pathname.startsWith("/dashboard")) {
    const url = request.nextUrl.clone();
    url.pathname = "/login";
    return NextResponse.redirect(url);
  }
  return response;
}
</code></pre>
<p><code>request.cookies.set()</code> must run <strong>before</strong> <code>NextResponse.next({ request })</code> is rebuilt, or the forwarded request keeps the old header, and the return value must be the reassigned <code>response</code>.</p>
<h2>Version and adapter reference</h2>
<table>
<thead>
<tr>
<th>Concern</th>
<th>Next.js 14</th>
<th>Next.js 15</th>
<th>Next.js 16</th>
</tr>
</thead>
<tbody><tr>
<td><code>cookies()</code></td>
<td>synchronous</td>
<td>Promise, must await</td>
<td>same as 15</td>
</tr>
<tr>
<td>Interception file</td>
<td><code>middleware.ts</code>, edge</td>
<td><code>middleware.ts</code>, edge or node</td>
<td><code>proxy.ts</code>, node only</td>
</tr>
<tr>
<td>Exported function</td>
<td><code>middleware</code></td>
<td><code>middleware</code></td>
<td><code>proxy</code></td>
</tr>
<tr>
<td>Cookie write in a render</td>
<td>throws</td>
<td>throws</td>
<td>throws</td>
</tr>
</tbody></table>
<table>
<thead>
<tr>
<th>Cookie adapter</th>
<th>Works in a render</th>
<th>Persists the refresh</th>
<th>Typical failure</th>
</tr>
</thead>
<tbody><tr>
<td><code>getAll</code> / <code>setAll</code></td>
<td>yes, writes skipped</td>
<td>yes, via proxy</td>
<td>none when the proxy returns its response</td>
</tr>
<tr>
<td><code>get</code> / <code>set</code> / <code>remove</code></td>
<td>partly</td>
<td>unreliable</td>
<td>drops <code>…-auth-token.1</code> chunks</td>
</tr>
<tr>
<td>Omitted entirely</td>
<td>reads <code>document</code></td>
<td>never</td>
<td><code>null</code> user every request</td>
</tr>
<tr>
<td>Two clients per request</td>
<td>yes</td>
<td>no</td>
<td><code>NavigatorLockAcquireTimeoutError</code></td>
</tr>
</tbody></table>
<p>Cookies beyond roughly 4 KB are chunked into <code>sb-&lt;ref&gt;-auth-token.0</code>, <code>.1</code>; an adapter returning only the base name returns half a session.</p>
<h2>Edge cases and the errors behind them</h2>
<h3>1. <code>Cookies can only be modified in a Server Action or Route Handler</code></h3>
<p>The message is literal: <code>set()</code> is legal in a Server Action, a Route Handler, and proxy, never during a render. Catching it is correct only if something else performs the write. If the loop persists, check the matcher — <code>["/dashboard/:path*"]</code> never runs for <code>/</code>, so a refresh there is thrown away.</p>
<pre><code class="language-ts">const { data: { user } } = await (await createClient()).auth.getUser();
if (!user) redirect("/login");   // redirect, never a manual cookie delete
</code></pre>
<h3>2. Reading the signed-out loop instead of guessing</h3>
<p>The loop has three breakages and one log line separates them:</p>
<pre><code class="language-ts">const { data: { session } } = await supabase.auth.getSession();
console.log({
  hasCookie: (await cookies()).getAll().some(c =&gt; c.name.startsWith("sb-")),
  sessionExpiry: session?.expires_at,
  now: Math.floor(Date.now() / 1000),
});
</code></pre>
<p><code>hasCookie: false</code> means the adapter never got the chunks; a past expiry with <code>hasCookie: true</code> means the refresh never persisted; a null session with both healthy means a client created before the proxy ran.</p>
<h3>3. <code>NavigatorLockAcquireTimeoutError</code> and the 2.107 change</h3>
<p><code>@supabase/auth-js</code> serialises refresh through the Web Locks API so two tabs cannot refresh the same token and invalidate it for each other. The auto-refresh tick asks for its lock with a 0 ms timeout, so it fails immediately when another holder is active. Before <code>supabase-js</code> 2.107.0 the mutex could also deadlock: awaiting another Supabase call inside <code>onAuthStateChange</code> waited on the lock the callback already held, and the next query never resolved.</p>
<pre><code class="language-ts">// 1. 2.107.0 removed the navigator.locks mutex
npm install @supabase/supabase-js@^2.107.0

// 2. older versions: keep the callback synchronous
supabase.auth.onAuthStateChange((_event, session) =&gt; {
  setSession(session);
  setTimeout(() =&gt; void hydrateProfile(), 0);  // defer Supabase calls
});
</code></pre>
<p>A custom <code>lock</code> function disables the browser lock if you cannot upgrade, trading a warning for a rarer bug — two tabs racing one refresh — so treat it as temporary.</p>
<h3>4. A Server Action must revalidate what it rendered</h3>
<p>A Server Action runs after the proxy, so its cookies are fresh, but the tree it returns was rendered with the pre-action state.</p>
<pre><code class="language-ts">"use server";
import { revalidatePath } from "next/cache";

export async function signOut() {
  const supabase = await createClient();
  await supabase.auth.signOut();
  revalidatePath("/", "layout");   // clears the cached tree that read the user
  redirect("/login");
}
</code></pre>
<p>Without it, sign-out works and the header keeps the avatar until a hard reload.</p>
<h3>5. Route Handlers can write, so let them</h3>
<pre><code class="language-ts">// app/auth/callback/route.ts
export async function GET(request: Request) {
  const { searchParams, origin } = new URL(request.url);
  const code = searchParams.get("code");
  const supabase = await createClient();

  if (code) {
    const { error } = await supabase.auth.exchangeCodeForSession(code);
    if (!error) return NextResponse.redirect(`${origin}/dashboard`);
  }
  return NextResponse.redirect(`${origin}/login?error=callback`);
}
</code></pre>
<p>The write lands in the response because a handler's cookie store is mutable. The same call in a Server Component returns a session already gone on the next request.</p>
<h3>6. <code>getSession()</code> versus <code>getUser()</code> on the server</h3>
<p><code>getSession()</code> decodes the JWT without verifying it: fine for display, wrong for authorisation. <code>getUser()</code> calls the auth server, verifies and refreshes; use it in proxy and every guard.</p>
<pre><code class="language-ts">const { data: { user }, error } = await supabase.auth.getUser();
if (error || !user) redirect("/login");
// authorise against user.id, never session.user from getSession()
</code></pre>
<h2>Common mistakes and version gotchas</h2>
<ul>
<li><strong><code>cookies()</code> without <code>await</code>.</strong> It returns a Promise in Next.js 15 and 16; the adapter then calls <code>.getAll()</code> on a Promise, and the failure surfaces far away as <code>Cannot read properties of undefined</code>.</li>
<li><strong>One client per render.</strong> <code>createBrowserClient</code> in a component body subscribes anew every render. Use a module-level singleton or <code>useState</code>.</li>
<li><strong><code>middleware.ts</code> left on Next.js 16.</strong> It runs, but <code>runtime</code> in its config now fails the build; <code>npx @next/codemod@canary middleware-to-proxy .</code> renames file and export.</li>
<li><strong>Redirect inside <code>try/catch</code>.</strong> <code>redirect()</code> throws a control-flow exception, and catching it swallows the navigation.</li>
<li><strong><code>@supabase/ssr</code> 0.4 and older.</strong> The legacy adapter silently drops chunked cookies.</li>
<li><strong><code>onAuthStateChange</code> returning a promise.</strong> The callback is not awaited, so work inside it races the next render.</li>
<li><strong>Service-role key with a <code>NEXT_PUBLIC_</code> prefix.</strong> It ships to the browser.</li>
</ul>
<p><strong>Related tools.</strong> Read <code>exp</code>, <code>sub</code>, and <code>role</code> from the <code>sb-…-auth-token</code> cookie without a round trip with the <a href="https://www.ryuslog.com/tools/jwt">JWT decoder</a>, inspect the stored session JSON with the <a href="https://www.ryuslog.com/tools/json">JSON formatter</a>, and convert <code>expires_at</code> with the <a href="https://www.ryuslog.com/tools/timestamp">timestamp converter</a>.</p>
]]></content:encoded></item><item><title><![CDATA[React 19 Hydration Mismatch: What Error 418 and 421 Actually Tell You]]></title><description><![CDATA[A server-rendered page flickers once after load, and the console shows Minified React error #418 pointing at react.dev/errors/418, or #421, which reads "A…]]></description><link>https://ryuslog.hashnode.dev/react-19-hydration-mismatch-what-error-418-and-421-actually-tell-you</link><guid isPermaLink="true">https://ryuslog.hashnode.dev/react-19-hydration-mismatch-what-error-418-and-421-actually-tell-you</guid><category><![CDATA[React]]></category><category><![CDATA[JavaScript]]></category><dc:creator><![CDATA[R (RYUSLOG DEV)]]></dc:creator><pubDate>Wed, 18 Nov 2026 05:53:16 GMT</pubDate><content:encoded><![CDATA[<p>A server-rendered page flickers once after load, and the console shows <code>Minified React error #418</code> pointing at <code>react.dev/errors/418</code>, or <code>#421</code>, which reads "A tree hydrated but some attributes of the server rendered HTML didn't match the client properties".</p>
<p>The page usually still works — which is exactly why these get ignored. But handlers attach late, layout shifts, and in Next.js the server HTML is discarded and re-rendered on the client: a visible flash and a hit to Core Web Vitals. Here is what each code means and the patterns that stop it.</p>
<h2>What hydration compares</h2>
<p>React walks the server HTML and the client tree in parallel. On the first disagreement it logs a recoverable error, throws away that subtree's server HTML and re-renders it on the client. React 19 also prints a DOM diff next to the warning — server HTML and client HTML side by side, with the offending node marked.</p>
<table>
<thead>
<tr>
<th>Code</th>
<th>What differs</th>
<th>Typical source</th>
</tr>
</thead>
<tbody><tr>
<td>#418</td>
<td>Text or element structure</td>
<td><code>Date</code>, random values, <code>window</code> reads in render</td>
</tr>
<tr>
<td>#419</td>
<td>A Suspense boundary that never resolved on the server</td>
<td>streaming without a server-seeded promise</td>
</tr>
<tr>
<td>#421</td>
<td>Attributes only (<code>class</code>, <code>style</code>, <code>data-*</code>)</td>
<td>theme scripts, extensions, ad blockers</td>
</tr>
<tr>
<td>#423</td>
<td>An error thrown during hydration outside a boundary</td>
<td>whole root switched to client rendering</td>
</tr>
<tr>
<td>#425</td>
<td>A text node only</td>
<td>locale and whitespace differences</td>
</tr>
</tbody></table>
<h2>The rule that fixes most of it</h2>
<p><strong>Make the first client render byte-identical to the server render.</strong> Not "close enough" — identical. Anything non-deterministic has to leave the render path.</p>
<pre><code class="language-tsx">// Broken: server sees no window, client sees a different value -&gt; #418
'use client';
export function Width() {
  const wide = typeof window !== 'undefined' &amp;&amp; window.innerWidth &gt; 900;
  return &lt;p&gt;{wide ? 'wide' : 'narrow'}&lt;/p&gt;;
}
</code></pre>
<pre><code class="language-tsx">// Fixed: the first render is "narrow" on both sides, then it updates
'use client';
import { useEffect, useState } from 'react';

export function Width() {
  const [wide, setWide] = useState(false);
  useEffect(() =&gt; {
    const mq = window.matchMedia('(min-width: 900px)');
    setWide(mq.matches);
    const onChange = (e: MediaQueryListEvent) =&gt; setWide(e.matches);
    mq.addEventListener('change', onChange);
    return () =&gt; mq.removeEventListener('change', onChange);
  }, []);
  return &lt;p&gt;{wide ? 'wide' : 'narrow'}&lt;/p&gt;;
}
</code></pre>
<p>Note that <code>typeof window !== 'undefined'</code> is not a fix. It removes the crash, not the mismatch: the server takes one branch and the client the other, which is precisely what #418 reports.</p>
<table>
<thead>
<tr>
<th>Non-deterministic source</th>
<th>Safe pattern</th>
</tr>
</thead>
<tbody><tr>
<td><code>new Date()</code></td>
<td>format with explicit <code>timeZone</code> and <code>locale</code>, or pass ISO from the server</td>
</tr>
<tr>
<td><code>Math.random()</code> for DOM ids</td>
<td><code>useId()</code></td>
</tr>
<tr>
<td><code>window</code>, <code>localStorage</code>, <code>matchMedia</code></td>
<td><code>useEffect</code> + state, or <code>useSyncExternalStore</code> with a server snapshot</td>
</tr>
<tr>
<td>Feature flags from cookies</td>
<td>read in middleware, pass as a prop</td>
</tr>
</tbody></table>
<h2>Case 1: a timestamp in a header</h2>
<p>Rendering "2 minutes ago" on the server guarantees a mismatch as soon as network latency crosses a minute.</p>
<pre><code class="language-tsx">// Broken
&lt;time&gt;{new Date(post.publishedAt).toLocaleString()}&lt;/time&gt;

// Fixed: same locale and zone on both sides
const fmt = new Intl.DateTimeFormat('en-US', {
  dateStyle: 'medium', timeStyle: 'short', timeZone: 'UTC',
});
&lt;time dateTime={post.publishedAt} suppressHydrationWarning&gt;
  {fmt.format(new Date(post.publishedAt))}
&lt;/time&gt;
</code></pre>
<p><code>suppressHydrationWarning</code> belongs on that single element and covers one level of text and attributes. It suppresses the warning, not the difference: the DOM text still differs until the client updates it. Set <code>TZ=UTC</code> in the container too, so the build server, the logs and the cache keys all agree.</p>
<h2>Case 2: invalid HTML nesting the parser repairs</h2>
<p>This one is underrated. Browsers restructure <code>&lt;p&gt;&lt;div/&gt;&lt;/p&gt;</code>, <code>&lt;a&gt;&lt;a/&gt;&lt;/a&gt;</code>, <code>&lt;table&gt;&lt;div/&gt;</code> and <code>&lt;button&gt;&lt;button/&gt;</code>. Your server sends valid-looking JSX, the parser outputs a different tree, and React cannot hydrate it. In the React 19 diff the element simply vanishes.</p>
<pre><code class="language-tsx">// Broken
&lt;p&gt;Total: &lt;strong&gt;{total}&lt;/strong&gt;{note &amp;&amp; &lt;div&gt;{note}&lt;/div&gt;}&lt;/p&gt;

// Fixed
&lt;div&gt;Total: &lt;strong&gt;{total}&lt;/strong&gt;{note &amp;&amp; &lt;p&gt;{note}&lt;/p&gt;}&lt;/div&gt;
</code></pre>
<h2>Case 3: #421 from theme scripts and extensions</h2>
<p>A script that runs <code>document.documentElement.className = 'dark'</code> before hydration, or an extension that adds <code>data-gr-ext-installed</code> to <code>&lt;body&gt;</code>, produces #421 on every page with no bug in your code. Confirm in a clean profile first, then tolerate the attribute where it is legitimately set:</p>
<pre><code class="language-tsx">// app/layout.tsx
&lt;html lang="en" suppressHydrationWarning&gt;
</code></pre>
<p>The accepted pattern is to guard <code>&lt;html&gt;</code> and <code>&lt;body&gt;</code>, not components in the tree.</p>
<h2>Case 4: #419 from Suspense boundaries</h2>
<p>A boundary that streams on the server and suspends again on the client gives #419 and a double render. Keep the same data reachable through a cache seeded from the server payload — what <code>use()</code> expects — instead of refetching in a <code>useEffect</code> that starts from <code>null</code>.</p>
<h2>React 19 renamed the messages</h2>
<p>Guides written for React 18 quote "Text content does not match server-rendered HTML", which now surfaces as #418 or #425 with an inline diff: search by code number, not old wording. <code>hydrate()</code> is also gone from the client entry — only <code>hydrateRoot</code> exists, so a vendored copy still calling <code>hydrate()</code> fails at runtime, not at build. To capture mismatches in production, pass <code>onRecoverableError</code> to <code>hydrateRoot</code> and report <code>error.message</code> with <code>info.componentStack</code>.</p>
<h2>Quick triage</h2>
<ol>
<li>Read the diff in the console first — it names the node.</li>
<li>Does <code>render</code> read <code>window</code>, <code>Date</code>, <code>Math.random</code> or a cookie? Move it to an effect.</li>
<li>Is the parent-child combination valid HTML? Does it vanish in a clean browser profile (then it is an extension)?</li>
<li>Structural mismatch (#418, #425)? <code>suppressHydrationWarning</code> will not help; fix the render.</li>
</ol>
<p>When you need to compare the server payload with what the client rendered, the <a href="https://www.ryuslog.com/tools/diff">text diff tool</a> and the <a href="https://www.ryuslog.com/tools/json">JSON formatter</a> make the <code>__next_f</code> payload readable.</p>
<p>The extended version, with the full table of codes and the streaming/deferred-script case, is on my site: <a href="https://www.ryuslog.com/blog/react-19-hydration-mismatch-error-418-421-causes-and-fixes">React 19 Hydration Mismatch: Error 418 and 421 Root Causes</a>.</p>
]]></content:encoded></item><item><title><![CDATA[CrashLoopBackOff: reading exit codes and debugging restart loops]]></title><description><![CDATA[CrashLoopBackOff is a restart backoff, not the error. Read exit codes 137, 143 and 1, check probes and startup order, and find the cause in order.]]></description><link>https://ryuslog.hashnode.dev/crashloopbackoff-reading-exit-codes-and-debugging-restart-loops</link><guid isPermaLink="true">https://ryuslog.hashnode.dev/crashloopbackoff-reading-exit-codes-and-debugging-restart-loops</guid><category><![CDATA[Kubernetes]]></category><category><![CDATA[Devops]]></category><dc:creator><![CDATA[R (RYUSLOG DEV)]]></dc:creator><pubDate>Tue, 17 Nov 2026 02:58:48 GMT</pubDate><content:encoded><![CDATA[<p>A shortened version of the full guide: <a href="https://www.ryuslog.com/blog/kubernetes-crashloopbackoff-causes-debugging-and-fixes">CrashLoopBackOff: reading exit codes and debugging restart loops</a>.</p>
<p><code>CrashLoopBackOff</code> is not the error. It is Kubernetes saying the container keeps exiting and the kubelet is delaying the next attempt (10s, 20s, 40s … capped at 5m). The error is whatever made the process exit.</p>
<h2>Read the last exit code first</h2>
<table>
<thead>
<tr>
<th>Last state</th>
<th>Meaning</th>
<th>Where to look</th>
</tr>
</thead>
<tbody><tr>
<td><code>exitCode: 137</code>, <code>reason: OOMKilled</code></td>
<td>kernel killed it for exceeding <code>limits.memory</code></td>
<td>container limit vs real working set</td>
</tr>
<tr>
<td><code>exitCode: 137</code>, no <code>OOMKilled</code></td>
<td>SIGKILL from node pressure or a delete</td>
<td><code>kubectl get events</code>, node MemoryPressure</td>
</tr>
<tr>
<td><code>exitCode: 143</code></td>
<td>SIGTERM, grace period ended</td>
<td>lifecycle hooks, <code>terminationGracePeriodSeconds</code></td>
</tr>
<tr>
<td><code>exitCode: 1</code> or <code>2</code></td>
<td>the app exited on its own</td>
<td><code>kubectl logs --previous</code></td>
</tr>
<tr>
<td><code>exitCode: 0</code></td>
<td>a process that should not be in a Deployment</td>
<td>command / entrypoint</td>
</tr>
</tbody></table>
<pre><code class="language-bash">kubectl get pod my-pod -o jsonpath='{.status.containerStatuses[*].lastState.terminated}' | jq
kubectl logs my-pod --previous --tail=100
kubectl describe pod my-pod | sed -n '/Events/,$p'
</code></pre>
<h2>The checks in order</h2>
<ol>
<li><code>kubectl logs --previous</code> — the crashing instance, not the new one.</li>
<li>Config: a missing <code>ConfigMap</code> key or <code>Secret</code> exits the process right after start.</li>
<li>Probes: a failing <code>livenessProbe</code> restarts a healthy app; too small an <code>initialDelaySeconds</code> reproduces the crash every few minutes. <code>kubectl describe</code> shows <code>Liveness probe failed</code>.</li>
<li>Startup order: the app dies before its dependency is up. A <code>startupProbe</code>, or a retry loop in the app, is the fix — not a longer <code>sleep</code>.</li>
<li>If the state is <code>ImagePullBackOff</code> instead, the tag or the pull secret is wrong, and that is a different problem.</li>
</ol>
<h2>When the loop hides the log</h2>
<p>If the container exits in under a second, <code>--previous</code> can be empty. Temporarily set <code>command: ["sh","-c","sleep 30"]</code>, exec in, and run the real start command by hand — that shows the actual error instead of the restart counter.</p>
<p>If the app sizes its own heap or pool at boot, compare that ceiling with <code>limits.memory</code>: the kernel charges the whole cgroup, so a heap above the limit guarantees <code>OOMKilled</code> under load even when the app never "used more memory".</p>
<h2>Reading configs while you debug</h2>
<p>All client-side: <a href="https://www.ryuslog.com/tools/yaml">YAML ↔ JSON</a> · <a href="https://www.ryuslog.com/tools/json">JSON formatter</a> · <a href="https://www.ryuslog.com/tools/diff">diff checker</a> · <a href="https://www.ryuslog.com/tools/base64">base64</a> for Secret values.</p>
<p>The full guide: <a href="https://www.ryuslog.com/blog/kubernetes-crashloopbackoff-causes-debugging-and-fixes">CrashLoopBackOff causes, debugging and fixes</a>.</p>
]]></content:encoded></item><item><title><![CDATA[15 developer tools that never upload your data]]></title><description><![CDATA[15 browser tools: JSON, YAML, diff, regex, SQL, CSV, JWT, Base64, hash, cURL, UUID, timestamp, cron, colour — with nothing uploaded.]]></description><link>https://ryuslog.hashnode.dev/15-developer-tools-that-never-upload-your-data</link><guid isPermaLink="true">https://ryuslog.hashnode.dev/15-developer-tools-that-never-upload-your-data</guid><category><![CDATA[webdev]]></category><dc:creator><![CDATA[R (RYUSLOG DEV)]]></dc:creator><pubDate>Mon, 16 Nov 2026 10:10:42 GMT</pubDate><content:encoded><![CDATA[<p>Most online developer tools are thin wrappers around a server: paste a JWT, a production config, or a customer's CSV, and it goes somewhere you cannot see. The fifteen tools at <a href="https://www.ryuslog.com/tools">ryuslog.com/tools</a> work the other way — everything runs in the tab, with <code>JSON.parse</code>, <code>crypto.subtle</code> and ordinary JavaScript. No upload, no account, no rate limit.</p>
<p>Here is what each one does, and the detail worth knowing before you use it.</p>
<h2>Data and configuration</h2>
<ul>
<li><strong>JSON Formatter</strong> — format, validate and minify, sort keys, unescape a pasted JSON string, and generate TypeScript interfaces from a real payload.</li>
<li><strong>YAML ↔ JSON</strong> — both directions with indent control, plus presets for Kubernetes manifests and GitHub Actions workflows.</li>
<li><strong>CSV ↔ JSON</strong> — CSV, TSV or semicolon-separated input with quoted fields, header control and a download of the result.</li>
<li><strong>SQL Formatter</strong> — PostgreSQL, MySQL and SQLite dialects, uppercase keywords, one clause per line.</li>
</ul>
<h2>Code and text</h2>
<ul>
<li><strong>Text Diff Checker</strong> — line-by-line comparison with added and removed highlighting, line numbers, and an ignore-whitespace mode for <code>git diff -w</code> style reviews.</li>
<li><strong>Regex Tester</strong> — live match highlighting, capture groups and a replacement preview, so a greedy quantifier is visible before it ships.</li>
<li><strong>cURL to Code</strong> — paste a curl command and get <code>fetch</code>, TypeScript, Python <code>requests</code> or Go <code>net/http</code> with headers and body intact. The shell quoting is the hard part, and it is what gets lost when you translate by hand.</li>
</ul>
<h2>Tokens and encoding</h2>
<ul>
<li><strong>JWT Decoder</strong> — header and payload side by side, every standard claim (<code>sub</code>, <code>iss</code>, <code>aud</code>, <code>exp</code>, <code>nbf</code>, <code>iat</code>, <code>jti</code>) with readable dates, and an expiry check.</li>
<li><strong>Base64 Encode / Decode</strong> — UTF-8 text both ways, including URL-safe Base64 for tokens and query strings.</li>
<li><strong>Hash Generator</strong> — MD5, SHA-1, SHA-256 and SHA-512 as you type, lower or upper case hex.</li>
<li><strong>URL Parser &amp; Encoder</strong> — split a URL into protocol, host, path and query parameters, or percent-encode and decode text.</li>
</ul>
<h2>Time and colour</h2>
<ul>
<li><strong>Timestamp Converter</strong> — Unix timestamps and date strings in both directions, with relative time and time zone views.</li>
<li><strong>Cron Expression Parser</strong> — explain a five-field expression in plain English and list the next times it will run, in local time and UTC.</li>
<li><strong>UUID Generator</strong> — 1 to 100 UUID v4 values, formatted for JSON or SQL.</li>
<li><strong>Color &amp; Contrast</strong> — HEX, RGB, HSL and OKLCH conversion with WCAG 2.1 AA/AAA contrast checks and copy-ready CSS and Tailwind snippets.</li>
</ul>
<h2>Why client-side is the point</h2>
<p>Two reasons. The first is privacy: a JWT is a bearer token, and a production YAML file often contains secrets; neither should travel to a stranger's server to be formatted. The second is durability: a tool with no backend cannot rate-limit you, log you out, or disappear behind a paywall.</p>
<p>The trade-offs are real, though. There is no history and no sync, and very large inputs are bounded by what a tab can hold. If you want the engineering details — OKLCH conversion, LCS diffing, cron next-run search, Web Crypto's gaps — they are written up at <a href="https://www.ryuslog.com">ryuslog.com</a>, and the same techniques show up in the guides on <a href="https://www.ryuslog.com/blog/kubernetes-resource-requests-limits-qos-classes-and-oomkilled">Kubernetes resources and OOMKilled</a> and <a href="https://www.ryuslog.com/blog/react-useeffect-dependencies-cleanup-and-race-conditions">React useEffect races</a>.</p>
]]></content:encoded></item></channel></rss>