<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Unbreak My App: new fixes</title><link>https://unbreakmyapp.vercel.app/fixes/</link><description>Free fixes for broken vibe-coded apps (Lovable, Bolt, Cursor, Replit, v0).</description><language>en</language><lastBuildDate>Tue, 01 Dec 2026 00:58:23 +0000</lastBuildDate><atom:link href="https://unbreakmyapp.vercel.app/feed.xml" rel="self" type="application/rss+xml"/>
<item><title>Supabase Edge Function callable by anyone (the anon key passes verify_jwt)</title><link>https://unbreakmyapp.vercel.app/fixes/edge-function-callable-by-anyone-anon-key-is-a-jwt.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/edge-function-callable-by-anyone-anon-key-is-a-jwt.html</guid><pubDate>Mon, 30 Nov 2026 06:00:00 +0000</pubDate><category>Auth</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><category>Replit</category><category>v0</category><description>Your Supabase Edge Function has verify_jwt on, yet logged-out visitors and curl scripts can still call it. The legacy anon key is itself a valid JWT and the platform check also accepts publishable keys, and both are public. Check for a real signed-in user inside the function before doing anything.</description><content:encoded>&lt;p&gt;Your Supabase Edge Function has verify_jwt on, yet logged-out visitors and curl scripts can still call it. The legacy anon key is itself a valid JWT and the platform check also accepts publishable keys, and both are public. Check for a real signed-in user inside the function before doing anything.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;verify_jwt is on, but my Edge Function still runs for logged-out users / anyone can call https://&amp;lt;project-ref&amp;gt;.supabase.co/functions/v1/my-function with curl using the key from my JavaScript bundle / my send-email, AI or credits function was spammed and ran up a bill / a security review says an Edge Function has no authentication / the function returns other users&amp;#x27; data or changes their records / I assumed &amp;#x27;Enforce JWT verification&amp;#x27; meant only signed-in users can call it&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;Supabase Edge Functions have a platform check called verify_jwt that is on by default. It looks at the Authorization header before your code runs and returns 401 if the header is missing, malformed or signed with a different key. Many AI-built apps treat that as &amp;#x27;only my logged-in users can call this function&amp;#x27;, but it is not. Supabase&amp;#x27;s API keys guide lists the legacy anon key as a long-lived JWT, and the platform check validates legacy JWTs, so a request carrying only the anon key passes. supabase-js does this for you: when nobody is signed in, the client falls back to sending the legacy anon key as the Bearer token. Projects on the newer keys are not safer by default either. Publishable keys are not JWTs, but Supabase says that for migration compatibility verify_jwt accepts publishable and secret keys on either header, and that passing the check does not authenticate the caller. Both the anon key and the publishable key are meant to be public: they ship in your web or mobile bundle, so anyone can copy them from DevTools and call your function from a script. So when Lovable, Bolt, Cursor, Replit or v0 writes a function that sends emails, calls OpenAI, grants credits or reads data with the service role client, and never checks who the user is, anyone on the internet can trigger it. It gets worse when the function uses a service role (or secret key) client, because Supabase notes that client bypasses Row Level Security, so a function that does not filter by the caller&amp;#x27;s id returns every user&amp;#x27;s rows.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Test it the way an attacker would. Copy your project URL and anon or publishable key from your site&amp;#x27;s JavaScript (DevTools &amp;gt; Sources or Network) and call the function with no user token: curl -i -X POST https://&amp;lt;project-ref&amp;gt;.supabase.co/functions/v1/&amp;lt;name&amp;gt; -H &amp;quot;apikey: &amp;lt;public key&amp;gt;&amp;quot; -H &amp;quot;Authorization: Bearer &amp;lt;same key if it starts with eyJ&amp;gt;&amp;quot; -H &amp;quot;Content-Type: application/json&amp;quot; -d &amp;#x27;{}&amp;#x27;. If it does the work instead of returning 401, the function is open to anyone.&lt;/li&gt;&lt;li&gt;List every Edge Function and decide who should be allowed to call it: a signed-in user (most app features), your own backend or cron (service-to-service), an external provider such as Stripe (webhook), or genuinely anyone (a health check). Write that next to each function name before changing code.&lt;/li&gt;&lt;li&gt;For user-facing functions, check the user inside the function, not just at the platform. Supabase&amp;#x27;s current pattern is the @supabase/server package: wrap the handler in withSupabase({ auth: &amp;#x27;user&amp;#x27; }, ...), which only accepts a valid user JWT on the Authorization header and gives you ctx.userClaims plus ctx.supabase, a client scoped to that user&amp;#x27;s RLS policies. In older code built with createClient, read the Authorization header, call supabase.auth.getUser(token), and return 401 if there is no user. Leave verify_jwt on for these functions as a first layer.&lt;/li&gt;&lt;li&gt;Use the caller&amp;#x27;s identity for every read and write. Prefer ctx.supabase (or a client created with the user&amp;#x27;s Authorization header) so RLS applies. If you must use ctx.supabaseAdmin or a service role / secret key client, Supabase warns it bypasses Row Level Security, so filter every query by the caller&amp;#x27;s id from the verified claims and never by a user_id sent in the request body.&lt;/li&gt;&lt;li&gt;For cron jobs, pg_net calls and other backend callers, require a secret key instead of a user: verify_jwt = false for that function in supabase/config.toml and withSupabase({ auth: &amp;#x27;secret&amp;#x27; }), which accepts only the project&amp;#x27;s secret key named default (or &amp;#x27;secret:&amp;lt;name&amp;gt;&amp;#x27; for a specific key). Keep secret keys on servers only; Supabase blocks them in browsers with 401, but they still work from scripts, so a leaked one must be rotated.&lt;/li&gt;&lt;li&gt;For external webhooks (Stripe, GitHub, Resend), set verify_jwt = false and use auth: &amp;#x27;none&amp;#x27;, then verify the provider&amp;#x27;s signature inside the handler before doing anything. Supabase&amp;#x27;s docs say auth: &amp;#x27;none&amp;#x27; disables every credential check, so the signature check is the only thing protecting the function.&lt;/li&gt;&lt;li&gt;Protect expensive functions even for signed-in users: anyone can create an account. Add a per-user rate limit (Supabase has an Upstash Redis rate limiting example keyed on the user id), cap spend on paid APIs such as OpenAI, and consider a CAPTCHA such as Cloudflare Turnstile on public forms that trigger a function.&lt;/li&gt;&lt;li&gt;Re-run the curl test with no user token (expect 401), with a real user&amp;#x27;s access token (expect success), and with one user&amp;#x27;s token asking for another user&amp;#x27;s data (expect 401, 403 or 404). Add these as automated tests so the next AI edit cannot quietly remove the check.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/functions/auth-headers&quot;&gt;Supabase: Authorization headers and the verify_jwt platform check&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/functions/auth&quot;&gt;Supabase: Securing Edge Functions (withSupabase auth modes)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/api/api-keys&quot;&gt;Supabase: API keys (anon is a legacy JWT; publishable keys are public; known limitations)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/functions/function-configuration&quot;&gt;Supabase: Function configuration (verify_jwt, --no-verify-jwt)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/functions/auth-legacy-jwt&quot;&gt;Supabase: Integrating Edge Functions with Supabase Auth (legacy getUser pattern)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/functions/error-codes&quot;&gt;Supabase: Edge Functions error codes (UNAUTHORIZED_*)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/functions/examples/rate-limiting&quot;&gt;Supabase: Rate limiting Edge Functions (Upstash Redis example)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://github.com/supabase/supabase-js/blob/master/packages/core/supabase-js/src/lib/fetch.ts&quot;&gt;supabase-js source: fetchWithAuth falls back to the API key as Bearer when no session&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://cwe.mitre.org/data/definitions/306.html&quot;&gt;MITRE CWE-306: Missing Authentication for Critical Functionality&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/edge-function-callable-by-anyone-anon-key-is-a-jwt.html&quot;&gt;Supabase Edge Function callable by anyone (the anon key passes verify_jwt)&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Supabase only returns 1,000 rows (max rows limit)</title><link>https://unbreakmyapp.vercel.app/fixes/supabase-only-1000-rows-returned-max-rows.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/supabase-only-1000-rows-returned-max-rows.html</guid><pubDate>Sun, 29 Nov 2026 06:00:00 +0000</pubDate><category>Database / Supabase RLS</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><category>Replit</category><category>v0</category><description>Your Supabase query stops at exactly 1,000 rows with no error, so lists, CSV exports, totals and dashboards quietly leave data out. Supabase returns at most 1,000 rows per request by default. Page through results with range(), get totals with count or a SQL function, and only raise Max rows if you really need to.</description><content:encoded>&lt;p&gt;Your Supabase query stops at exactly 1,000 rows with no error, so lists, CSV exports, totals and dashboards quietly leave data out. Supabase returns at most 1,000 rows per request by default. Page through results with range(), get totals with count or a SQL function, and only raise Max rows if you really need to.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;My Supabase select returns exactly 1000 rows but the table has more / .limit(5000) still gives me 1000 rows / CSV export or admin table is missing the newest records / totals and charts are wrong once the table passes 1,000 rows / data.length is 1000 but the dashboard row count is higher / the response header shows Content-Range: 0-999/* / an rpc() call that returns a set of rows also stops at 1000&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;Supabase&amp;#x27;s Data API (PostgREST) has a hard cap on how many rows one request can return. Supabase&amp;#x27;s docs say projects return a maximum of 1,000 rows by default, and the CLI config describes the same api.max_rows setting as the maximum number of rows returned from a view, table or function. When a query matches more rows than that, you get the first 1,000 and no error, so nothing looks broken until someone notices missing records. Asking for more with .limit(5000) does not help, because PostgREST treats max rows as a hard limit. AI builders hit this in three common ways: a list, table or export loads everything with one select() and no paging; the app computes totals, sums or charts in JavaScript from data.length or a loop over the result, so the numbers silently stop at 1,000 rows; or a Postgres function called with rpc() returns a set of rows, which is capped the same way. Supabase recommends keeping the limit low to limit the size of accidental or malicious requests, and paginating with range().&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Confirm it is the row cap. Run the same filter as a count in the SQL editor (select count(*) from your_table where ...) and compare it with data.length in the app. If the app shows exactly 1,000 (or whatever your Max rows setting is) while the count is higher, this is the cause. In DevTools &amp;gt; Network you can also open the request to /rest/v1/your_table and look at the Content-Range response header: 0-999/* means the first 1,000 rows were returned.&lt;/li&gt;&lt;li&gt;Page through large lists instead of loading everything. Use range(from, to), which Supabase documents as 0-based and inclusive, so range(0, 49) is the first 50 rows and range(50, 99) the next 50. Always add an order() on a unique column such as id or created_at plus id, because Supabase warns that range without an order clause can behave unexpectedly and rows can repeat or go missing between pages.&lt;/li&gt;&lt;li&gt;Show the real total. Ask Supabase for the count instead of using data.length: select(&amp;#x27;*&amp;#x27;, { count: &amp;#x27;exact&amp;#x27;, head: true }) returns only the count, and adding count to a range() query returns the total number of matching rows, not the page size. On very large tables &amp;#x27;exact&amp;#x27; runs a full COUNT(*) and gets slow; supabase-js also accepts &amp;#x27;planned&amp;#x27; (fast estimate from Postgres statistics) and &amp;#x27;estimated&amp;#x27; (exact for small numbers, planned for large ones).&lt;/li&gt;&lt;li&gt;Fix exports and background jobs that need every row. Loop: fetch range(0, 999), then range(1000, 1999) and so on, ordered by id, until a page comes back with fewer rows than you asked for. For big tables, page by the last id instead of an offset: .gt(&amp;#x27;id&amp;#x27;, lastId).order(&amp;#x27;id&amp;#x27;).limit(1000). Run large exports on the server (an API route or Edge Function) rather than in the browser.&lt;/li&gt;&lt;li&gt;Move totals, sums and charts into the database. Instead of downloading rows to add them up in JavaScript, write a Postgres function that returns the single number or the small grouped result (for example select sum(amount) ... group by month) and call it with supabase.rpc(). A function that returns one row is not affected by the cap, and RLS still applies if the function is not security definer.&lt;/li&gt;&lt;li&gt;Fix rpc() calls that return many rows. Max rows applies to functions too. Add paging inside the function (limit and offset parameters), or chain range() and order() on the rpc() call for set-returning functions, the same way as for a table.&lt;/li&gt;&lt;li&gt;Only raise Max rows if you really need to, and know the trade-off. It is a project setting in the Supabase dashboard&amp;#x27;s Data API / API settings (api.max_rows in supabase/config.toml for local development). Supabase recommends keeping it low, because every query without paging gets heavier and anyone with your public key can pull more rows per request. Paging is the real fix; raising the cap only moves the cliff.&lt;/li&gt;&lt;li&gt;Test with more than 1,000 rows. Seed a test project or branch with a few thousand rows and check every list, search, export, total and chart. Add an automated check that the count shown in the UI matches select count(*) for the same filter.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/reference/javascript/select&quot;&gt;Supabase JS reference: select (1,000 row default, count option)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/reference/javascript/range&quot;&gt;Supabase JS reference: range (0-based, inclusive, needs order)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/reference/javascript/rpc&quot;&gt;Supabase JS reference: rpc&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/local-development/cli/config&quot;&gt;Supabase CLI config: api.max_rows&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/functions&quot;&gt;Supabase: Database functions&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.postgrest.org/en/stable/references/configuration.html&quot;&gt;PostgREST: db-max-rows configuration (hard limit)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.postgrest.org/en/stable/references/api/pagination_count.html&quot;&gt;PostgREST: Pagination and count (Content-Range, exact, planned, estimated)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://github.com/supabase/supabase-js/blob/master/packages/core/postgrest-js/src/PostgrestQueryBuilder.ts&quot;&gt;supabase-js source: count options (exact, planned, estimated)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/supabase-only-1000-rows-returned-max-rows.html&quot;&gt;Supabase only returns 1,000 rows (max rows limit)&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Changing the id in the URL shows other users&#x27; data (IDOR)</title><link>https://unbreakmyapp.vercel.app/fixes/change-id-in-url-see-other-users-data-idor.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/change-id-in-url-see-other-users-data-idor.html</guid><pubDate>Thu, 26 Nov 2026 06:00:00 +0000</pubDate><category>Database / Supabase RLS</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><category>Replit</category><category>v0</category><description>Change the id in a URL like /invoices/123 to 124 and you see another user&#x27;s invoice? That is an IDOR (broken object level authorization). Hiding the link does not help. Check ownership on every read, update and delete: Supabase RLS with auth.uid() for browser queries, and a verified user id in every API route or Server Action.</description><content:encoded>&lt;p&gt;Change the id in a URL like /invoices/123 to 124 and you see another user&amp;#x27;s invoice? That is an IDOR (broken object level authorization). Hiding the link does not help. Check ownership on every read, update and delete: Supabase RLS with auth.uid() for browser queries, and a verified user id in every API route or Server Action.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;I changed /orders/123 to /orders/124 (or ?id=, or a UUID copied from somewhere else) and saw another customer&amp;#x27;s order, invoice, profile or file / an API route like /api/invoices/[id] returns any record for any logged-in user / a hidden user_id field in a form or request body lets me edit someone else&amp;#x27;s row / delete works on rows I do not own / a security review or pentest reports IDOR, BOLA (OWASP API1:2023), CWE-639 or broken access control&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;An IDOR (insecure direct object reference) needs three things, as OWASP&amp;#x27;s IDOR Prevention Cheat Sheet puts it: an object (an order, invoice, profile, file), a reference to it (an id, UUID, slug or file name in the URL, query string or request body) and a missing check that the current user is allowed to access that object. AI builders make the third one easy to miss. The page loads the record with something like select * from invoices where id = params.id, and nothing asks whose invoice it is. In vibe-coded apps it usually shows up in four ways. 1) RLS is off, or a policy uses (true), so the Supabase API returns any row to anyone with the public key. 2) The browser query adds .eq(&amp;#x27;user_id&amp;#x27;, user.id), but that filter is not security: anyone can call the same API without it. 3) An API route, Server Action or Edge Function uses the service_role or sb_secret_ key, which bypasses RLS, and then looks the row up by the id the caller sent. 4) The server trusts a user_id sent by the client, or reads the user from supabase.auth.getSession() on the server, which Supabase says reads the cookie without revalidating it. Random UUIDs make ids harder to guess, but they leak in links, shares and logs, and OWASP says the access check is still required.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Prove it with two accounts. Create User A and User B, and give each one at least one record (order, invoice, project, file). Log in as A, open one of B&amp;#x27;s records by pasting B&amp;#x27;s id into the URL, then try the same id in every API call in DevTools &amp;gt; Network (GET, PATCH, DELETE, exports and downloads). Also try it logged out. Any response with B&amp;#x27;s data, or a successful change, is an IDOR.&lt;/li&gt;&lt;li&gt;List every place an id comes from the client: route params (/orders/[id]), query strings (?id=), request bodies (including hidden user_id or owner_id fields), file paths and download links. For each one, write down which table it reads or changes and which code runs the query (browser Supabase client, API route, Server Action, Edge Function).&lt;/li&gt;&lt;li&gt;For queries that run in the browser, let RLS do the ownership check. Turn on RLS on every table in an exposed schema and add owner policies to the authenticated role, for example: create policy &amp;quot;Owners can read&amp;quot; on invoices for select to authenticated using ((select auth.uid()) = user_id). Add matching insert (with check), update (using and with check, so nobody can move a row to another user_id) and delete policies. Never add an &amp;#x27;or auth.uid() is null&amp;#x27; branch: Supabase warns it returns every row to logged-out requests.&lt;/li&gt;&lt;li&gt;Do not count a frontend filter as security. .eq(&amp;#x27;user_id&amp;#x27;, user.id) in browser code is fine for performance, but the caller can remove it and call the API with your public key. Only the RLS policy (or a server-side check) protects the row. Keep an index on user_id so the policy stays fast.&lt;/li&gt;&lt;li&gt;Fix server code that bypasses RLS. Search API routes, Server Actions and Edge Functions for service_role, SUPABASE_SERVICE_ROLE_KEY or sb_secret_. If one of them looks up a record by an id from the request, either switch it to a client created with the publishable (or anon) key and the user&amp;#x27;s session so RLS applies, or keep the secret key and add the owner filter yourself: .eq(&amp;#x27;id&amp;#x27;, id).eq(&amp;#x27;user_id&amp;#x27;, userId). Supabase notes a secret key bypasses RLS only when no user access token is sent with the request.&lt;/li&gt;&lt;li&gt;Get the user id from a verified token, never from the request. On the server, call supabase.auth.getClaims() (or getUser()) and use the sub claim as the user id. Supabase says never to trust getSession() in server code, because the session cookie can be forged. Ignore any user_id, owner_id or role field in the body or query string; set the owner on the server instead.&lt;/li&gt;&lt;li&gt;Check every entry point, not just the page. Next.js says a page-level auth check does not extend to the Server Actions defined in it, and that you must also check the user may act on that specific resource to prevent IDOR. Server Actions can be called with a direct POST request. Put the check inside each action, route handler and Edge Function, or in one server-only data access layer that every one of them uses.&lt;/li&gt;&lt;li&gt;Return the same answer for &amp;#x27;not yours&amp;#x27; and &amp;#x27;does not exist&amp;#x27;. Scope the lookup to the current user (where id = ? and user_id = ?) and return 404 when nothing matches, so an attacker cannot tell which ids exist. Log repeated failures; OWASP suggests alerting on them.&lt;/li&gt;&lt;li&gt;Cover shared data and files too. If records are shared with a team, check membership in the policy (a team_members table) instead of only user_id. For Supabase Storage, put files under a folder named after the user id and add storage.objects policies, or serve private files with short-lived signed URLs, so changing a file path in a link does not open someone else&amp;#x27;s file.&lt;/li&gt;&lt;li&gt;Verify and keep it fixed. Repeat the two-account test for read, create, update, delete and export. Then add an automated test (or a Supabase policy test under supabase/tests) that signs in as User A and asserts that every request for User B&amp;#x27;s ids returns nothing or 404. OWASP recommends running such tests and not deploying changes that make them fail.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://cheatsheetseries.owasp.org/cheatsheets/Insecure_Direct_Object_Reference_Prevention_Cheat_Sheet.html&quot;&gt;OWASP: Insecure Direct Object Reference Prevention Cheat Sheet&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://owasp.org/API-Security/editions/2023/en/0xa1-broken-object-level-authorization/&quot;&gt;OWASP API Security Top 10: API1:2023 Broken Object Level Authorization&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://owasp.org/Top10/2025/A01_2025-Broken_Access_Control/&quot;&gt;OWASP Top 10:2025 A01 Broken Access Control&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://cwe.mitre.org/data/definitions/639.html&quot;&gt;MITRE CWE-639: Authorization Bypass Through User-Controlled Key&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/postgres/row-level-security&quot;&gt;Supabase: Row Level Security (owner policies, with check, auth.uid() is null warning, bypassing RLS)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/kb/troubleshooting/why-is-my-service-role-key-client-getting-rls-errors-or-not-returning-data-7_1K9z&quot;&gt;Supabase: Why is my service role key client getting RLS errors or not returning data?&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/auth/server-side/nextjs&quot;&gt;Supabase: Setting up server-side Auth for Next.js (getClaims, never trust getSession on the server)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/reference/javascript/auth-getclaims&quot;&gt;Supabase JS reference: getClaims&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/storage/security/access-control&quot;&gt;Supabase: Storage access control&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://nextjs.org/docs/app/guides/data-security&quot;&gt;Next.js: How to think about data security (Server Actions, authorization, IDOR)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/change-id-in-url-see-other-users-data-idor.html&quot;&gt;Changing the id in the URL shows other users&amp;#x27; data (IDOR)&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Login rate limit only counts per email: credential stuffing gets through</title><link>https://unbreakmyapp.vercel.app/fixes/login-rate-limit-only-per-email-credential-stuffing.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/login-rate-limit-only-per-email-credential-stuffing.html</guid><pubDate>Wed, 25 Nov 2026 06:00:00 +0000</pubDate><category>Auth</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><category>Replit</category><category>v0</category><description>Your login has a rate limit, but it only counts failed attempts per email, so an attacker with a leaked email and password list tries each account once from many IP addresses and never trips it. Add CAPTCHA, offer MFA, block leaked passwords, keep limits per IP and per account, and make sure nobody can skip your limit by calling Supabase directly.</description><content:encoded>&lt;p&gt;Your login has a rate limit, but it only counts failed attempts per email, so an attacker with a leaked email and password list tries each account once from many IP addresses and never trips it. Add CAPTCHA, offer MFA, block leaked passwords, keep limits per IP and per account, and make sure nobody can skip your limit by calling Supabase directly.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Users report their account was taken over even though my login has a rate limit / Auth logs show many failed sign-ins, each for a different email, often one or two tries each / a security scan says login rate limiting is keyed only on username or email (credential stuffing, password spraying) / my per-email lockout locks real users out / every user suddenly gets 429 over_request_rate_limit because my server calls signInWithPassword for everyone&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;AI builders usually add a login limit like &amp;#x27;block an email after 5 failed tries&amp;#x27;. That stops one kind of attack, guessing many passwords for one account (brute force). It does not stop credential stuffing, where an attacker takes email and password pairs leaked from other sites and tries each pair once on your app, or password spraying, where one common password is tried against many accounts. OWASP&amp;#x27;s Credential Stuffing Prevention Cheat Sheet describes both and says toolkits spread requests over large proxy networks so the volume per IP address stays low, which can defeat IP block lists and rate limiting. So a per-email counter never reaches its threshold, and a per-IP counter alone can be dodged too. Two vibe-coding details make it worse. First, if the browser calls supabase.auth.signInWithPassword with your public key, your own limiter in an API route is never in the path: anyone can call the Supabase Auth endpoint directly, and only Supabase&amp;#x27;s own per-IP limits apply (by default 150 requests per 5 minutes per IP for the /auth/v1/token endpoint that password sign-in uses, with bursts up to 30). Second, if your server calls Supabase for every user, Supabase sees your server&amp;#x27;s IP, so all users share one limit and real people get 429 over_request_rate_limit unless you forward the user&amp;#x27;s IP. A hard lockout per email has its own problem: OWASP warns it can be used to lock other users out on purpose.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Find out how your login works. Search the code for signInWithPassword. If it runs in the browser, your own rate limit code (if any) is not protecting the Supabase Auth endpoint, because anyone can call it directly with your public key. If it runs on your server (an API route, Server Action or Edge Function), note that Supabase sees your server&amp;#x27;s IP address, not the user&amp;#x27;s.&lt;/li&gt;&lt;li&gt;Check the signs of an attack. In the Supabase dashboard open Logs and the Auth logs and look for many failed password sign-ins (invalid_credentials) across many different emails, or bursts from many IP addresses. Supabase Auth audit logs record sign-ins, password changes and resets; you can also write them to the auth.audit_log_entries table to search them with SQL.&lt;/li&gt;&lt;li&gt;Review Supabase&amp;#x27;s own limits instead of building your own first. Go to Authentication &amp;gt; Rate Limits. Supabase uses a token bucket per IP address: the token endpoint (password, refresh token and PKCE sign-ins) defaults to 150 requests per 5 minutes with bursts up to 30, and sign-ups, magic links and password resets default to 30 per 5 minutes. Over the limit, Supabase answers 429 with over_request_rate_limit. Lower the values if your real traffic allows it. These are per IP, so treat them as one layer, not the whole defence.&lt;/li&gt;&lt;li&gt;If your server signs users in, forward the real user IP. Otherwise every user shares your server&amp;#x27;s limit, and an attacker hitting your server can lock everyone out. Turn on IP Address Forwarding under Authentication &amp;gt; Rate Limits, then on the server send the Sb-Forwarded-For header with the end user&amp;#x27;s IP. Supabase only accepts this header together with a secret API key (sb_secret_...), not the publishable or legacy anon key, so keep that key on the server only.&lt;/li&gt;&lt;li&gt;Turn on CAPTCHA for sign-in, sign-up and password reset. In Authentication &amp;gt; Bot and Abuse Protection, enable CAPTCHA protection and choose hCaptcha or Cloudflare Turnstile with its secret key. Then add the widget to your forms and pass its token: supabase.auth.signInWithPassword({ email, password, options: { captchaToken } }), and the same option on signUp and resetPasswordForEmail. If you forget the token, sign-in fails with captcha_failed. Reset the widget after each try. OWASP calls CAPTCHA defence in depth, not a complete fix, because some CAPTCHAs can be solved by services.&lt;/li&gt;&lt;li&gt;Offer MFA, and require it for admins. OWASP calls multi-factor authentication by far the best defence against credential stuffing and password spraying. Supabase&amp;#x27;s TOTP (authenticator app) MFA API is free and enabled on all projects by default. Let users enrol, check the aal2 level in your app and in RLS policies for sensitive actions, and make it mandatory for every admin account.&lt;/li&gt;&lt;li&gt;Stop leaked passwords at sign-up and password change. In Supabase Auth password settings set a minimum length (Supabase says less than 8 is not recommended) and, on the Pro plan and above, turn on leaked password protection, which checks passwords against HaveIBeenPwned&amp;#x27;s Pwned Passwords. On the Free plan you can call the Pwned Passwords range API yourself from your server before sign-up: HIBP says it is free and needs no API key, and you only send the first 5 characters of the password&amp;#x27;s SHA-1 hash.&lt;/li&gt;&lt;li&gt;If you keep your own limiter, count more than one thing and do not hard-lock accounts. Count failures per account and per IP, watch the total failure rate across all accounts (one attempt each on hundreds of emails is the stuffing pattern), and respond by asking for a CAPTCHA or adding a growing delay rather than locking the account for good. OWASP warns that lockouts can be abused to lock out other users and suggests still letting a locked user recover through the forgot password flow. Show the same generic message (for example &amp;#x27;Email or password is incorrect&amp;#x27;) whether the email exists or not.&lt;/li&gt;&lt;li&gt;Verify. In a private window, try a wrong password several times: you should see the generic error and then the CAPTCHA or a delay, never a message that says the email does not exist. Remove the captchaToken in a test build and confirm sign-in fails with captcha_failed. If your server signs users in, confirm two different users on different networks are rate limited separately. Then sign in as an admin and confirm MFA is required.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://cheatsheetseries.owasp.org/cheatsheets/Credential_Stuffing_Prevention_Cheat_Sheet.html&quot;&gt;OWASP: Credential Stuffing Prevention Cheat Sheet&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://cheatsheetseries.owasp.org/cheatsheets/Authentication_Cheat_Sheet.html&quot;&gt;OWASP: Authentication Cheat Sheet (generic errors, login throttling, account lockout)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://owasp.org/Top10/2025/A07_2025-Authentication_Failures/&quot;&gt;OWASP Top 10:2025 A07 Authentication Failures (credential stuffing, MFA)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/auth/rate-limits&quot;&gt;Supabase: Auth rate limits (token bucket, defaults, IP address forwarding)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/auth/auth-captcha&quot;&gt;Supabase: Enable CAPTCHA protection (hCaptcha, Turnstile)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/reference/javascript/auth-signinwithpassword&quot;&gt;Supabase JS reference: signInWithPassword (options.captchaToken)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/auth/auth-mfa&quot;&gt;Supabase: Multi-factor authentication (aal1, aal2)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/auth/password-security&quot;&gt;Supabase: Password security (leaked password protection, Pro plan)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/auth/debugging/error-codes&quot;&gt;Supabase: Auth error codes (over_request_rate_limit, captcha_failed)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/auth/audit-logs&quot;&gt;Supabase: Auth audit logs&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://haveibeenpwned.com/API/v3&quot;&gt;Have I Been Pwned: API v3 (Pwned Passwords range search, no key needed)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://developers.cloudflare.com/turnstile/&quot;&gt;Cloudflare Turnstile documentation&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/login-rate-limit-only-per-email-credential-stuffing.html&quot;&gt;Login rate limit only counts per email: credential stuffing gets through&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Supabase Storage file links broken: private bucket, getPublicUrl and expired signed URLs</title><link>https://unbreakmyapp.vercel.app/fixes/supabase-storage-private-bucket-file-url-broken-signed-url.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/supabase-storage-private-bucket-file-url-broken-signed-url.html</guid><pubDate>Tue, 24 Nov 2026 06:00:00 +0000</pubDate><category>Database / Supabase RLS</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><category>Replit</category><category>v0</category><description>Uploads work but every image or file link is broken, or links work for an hour and then die. Your app is making public links for a private Supabase Storage bucket, or saving signed links that expire. Pick public or private on purpose, then use createSignedUrl and save the file path, not the link.</description><content:encoded>&lt;p&gt;Uploads work but every image or file link is broken, or links work for an hour and then die. Your app is making public links for a private Supabase Storage bucket, or saving signed links that expire. Pick public or private on purpose, then use createSignedUrl and save the file path, not the link.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Images show as broken icons and opening the file link shows {&amp;quot;statusCode&amp;quot;:&amp;quot;404&amp;quot;,&amp;quot;error&amp;quot;:&amp;quot;Bucket not found&amp;quot;} even though the bucket exists / the browser console shows 400 (Bad Request) for /storage/v1/object/public/... / file links worked yesterday and now return InvalidJWT &amp;quot;exp&amp;quot; claim timestamp check failed / createSignedUrl returns Object not found / the image only loads for me, not for other users&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;Supabase Storage buckets are private by default, and a private bucket has no public link. Supabase gives you only two ways to read a file from a private bucket: download it with the signed-in user&amp;#x27;s token (which your Storage policies check), or create a signed URL with createSignedUrl that works for a limited time. AI builders often create the bucket private (the default) but write getPublicUrl(), which only builds an address for a public bucket. Supabase&amp;#x27;s reference says this function does not check whether the bucket is public, so it never fails or warns; when a browser opens that /object/public/ address, Storage only looks among public buckets and answers Bucket not found. The second version of the problem is a signed URL saved into a table: createSignedUrl takes expiresIn in seconds, the link stops working when that time passes, and the saved link stays broken forever. A third version: createSignedUrl itself checks your Row Level Security policies on storage.objects, so without a SELECT policy that lets this user read the file it answers Object not found. The tempting quick fix, making the bucket public, means anyone with the link can read every file in it, which is fine for avatars and product photos but not for invoices, IDs or private uploads.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Find out which case you have. Copy a broken file link and look at it. If it contains /storage/v1/object/public/&amp;lt;bucket&amp;gt;/, open Storage &amp;gt; Buckets in the Supabase dashboard (or run select id, public from storage.buckets; in the SQL Editor) and check whether that bucket is public. Public = false means case 1: a public link to a private bucket. If the link contains /object/sign/ and ?token=, it is a signed URL and has probably expired (case 2). Also check the bucket name matches exactly, including capitals.&lt;/li&gt;&lt;li&gt;Decide public or private on purpose. Ask: should anyone who gets the link be able to see this file? Avatars, product photos and blog images: usually yes, so a public bucket is fine. Supabase notes public buckets also cache better. Invoices, ID scans, contracts, private photos and anything per user: no, keep the bucket private. Public only opens reading; uploads, deletes and moves still need policies on storage.objects.&lt;/li&gt;&lt;li&gt;For a public bucket, keep getPublicUrl. Turn on Public bucket in the bucket settings, or run update storage.buckets set public = true where id = &amp;#x27;your-bucket&amp;#x27;; Existing getPublicUrl links start working. Do not do this for a bucket that holds private files, because every file in it becomes readable by anyone with its address.&lt;/li&gt;&lt;li&gt;For a private bucket, replace getPublicUrl with createSignedUrl. Call supabase.storage.from(&amp;#x27;documents&amp;#x27;).createSignedUrl(path, 3600) when you are about to show the file and use data.signedUrl as the img src or download link. The second argument is seconds until expiry (3600 = one hour). For many files use createSignedUrls(paths, 3600) in one call. Pass { download: true } if the link should download instead of open.&lt;/li&gt;&lt;li&gt;Save the file path, never the signed link. In your table store only the object path (for example user-id/invoice-42.pdf). Create a fresh signed URL each time the page loads or the file is shown. If you already saved signed links, write a one-off script that strips them back to paths, and change the upload code so it stops saving signedUrl.&lt;/li&gt;&lt;li&gt;Add the Storage policy that lets the right user read the file. Signed URLs are only created for files the requesting user may read under the SELECT policies on storage.objects, otherwise you get Object not found. A common pattern is uploading to a folder named after the user id and a SELECT policy such as bucket_id = &amp;#x27;documents&amp;#x27; and (storage.foldername(name))[1] = (select auth.jwt()-&amp;gt;&amp;gt;&amp;#x27;sub&amp;#x27;). Never put the service role key in the browser to make the error go away; it bypasses all policies.&lt;/li&gt;&lt;li&gt;Pick a sensible expiry. Short links (minutes to an hour) are safer for private files. Supabase notes you cannot revoke a single signed URL: to cut one off early you must delete, move or rename the file, or rotate the project&amp;#x27;s URL signing key. Do not create week-long links for private documents just to avoid regenerating them.&lt;/li&gt;&lt;li&gt;Verify. Sign in as a normal user in a private window and check the image or file opens. Sign in as a second user and check they cannot get the first user&amp;#x27;s file. Open an old public link to a private file: it should still fail. Wait past the expiry of a short test link and confirm the page creates a new one instead of showing a broken image.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/storage/buckets/fundamentals&quot;&gt;Supabase: Storage buckets (public vs private, private by default)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/storage/serving/downloads&quot;&gt;Supabase: Serving assets from Storage (public URLs, signed URLs, revoking)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/reference/javascript/storage-from-getpublicurl&quot;&gt;Supabase JS reference: getPublicUrl (does not verify the bucket is public)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/reference/javascript/storage-from-createsignedurl&quot;&gt;Supabase JS reference: createSignedUrl (expiresIn in seconds)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/reference/javascript/storage-from-createsignedurls&quot;&gt;Supabase JS reference: createSignedUrls&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/storage/security/access-control&quot;&gt;Supabase: Storage access control (policies on storage.objects, signed URLs)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/storage/debugging/error-codes&quot;&gt;Supabase: Storage error codes&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/storage/buckets/creating-buckets&quot;&gt;Supabase: Creating buckets&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/storage/cdn/fundamentals&quot;&gt;Supabase: Storage CDN (public vs private caching)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://github.com/supabase/storage/blob/master/src/http/routes/object/getPublicObject.ts&quot;&gt;Supabase Storage source: public object route only serves public buckets&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/supabase-storage-private-bucket-file-url-broken-signed-url.html&quot;&gt;Supabase Storage file links broken: private bucket, getPublicUrl and expired signed URLs&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Demo login, auto-login or hard-coded test credentials left in your live app</title><link>https://unbreakmyapp.vercel.app/fixes/preview-auto-login-hardcoded-credentials-left-in-production.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/preview-auto-login-hardcoded-credentials-left-in-production.html</guid><pubDate>Mon, 23 Nov 2026 06:00:00 +0000</pubDate><category>Auth</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><category>Replit</category><category>v0</category><description>Your AI builder added a demo login, a prefilled test account, a &#x27;skip login&#x27; button or code that signs you in automatically while you built the app, and it is still in the live version. Find it in the code and the bundle, remove it, delete or lock the test accounts, and rotate anything exposed.</description><content:encoded>&lt;p&gt;Your AI builder added a demo login, a prefilled test account, a &amp;#x27;skip login&amp;#x27; button or code that signs you in automatically while you built the app, and it is still in the live version. Find it in the code and the bundle, remove it, delete or lock the test accounts, and rotate anything exposed.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Anyone can open my live app and is already signed in (often as admin) / the login form comes prefilled with admin@test.com or a demo password / a &amp;#x27;Skip login&amp;#x27;, &amp;#x27;Demo mode&amp;#x27; or &amp;#x27;Continue as test user&amp;#x27; button still shows in production / a security scan reports &amp;#x27;Hard-coded credentials (CWE-798)&amp;#x27; or &amp;#x27;Active debug code (CWE-489)&amp;#x27; / I found the test password in the JavaScript bundle or in my GitHub repo&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;While you build, a login screen gets in the way of every test, so AI builders often add a shortcut: a demo or test account with a simple password, credentials typed straight into the login form or a seed script, a &amp;#x27;skip login&amp;#x27; or &amp;#x27;demo mode&amp;#x27; button, or code that signs in automatically when the app runs in preview. The shortcut is meant to be temporary, but nothing removes it when you publish. OWASP&amp;#x27;s testing guide lists this exact root cause: programmers who leave back doors to easily access and test their application and later forget to remove them. Anything in front-end code reaches every visitor&amp;#x27;s browser: Vite and Next.js copy VITE_ and NEXT_PUBLIC_ variables into the JavaScript bundle at build time, so a test password stored there is public. Only code inside if (import.meta.env.DEV) is removed from Vite production builds; a custom flag such as VITE_DEMO_MODE=true, a hostname check or a localStorage switch ships in the bundle and can be turned on by anyone. Even when the code is gone, the test account usually still exists in Supabase Auth or your users table with its known password, and often with an admin role. OWASP Top 10 2025 (A07 Authentication Failures) says not to ship or deploy with any default credentials, particularly for admin users, and lists CWE-798 Use of Hard-coded Credentials.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Check it from the outside first. Open your live URL in a private window. If you land inside the app without logging in, or the login form is already filled in, or a demo or skip button appears, you have this problem. Then open DevTools &amp;gt; Sources (or view the JavaScript files under Network) and search the bundle for words like password, demo, test@, admin@, autoLogin, skipAuth, bypass and signInWithPassword.&lt;/li&gt;&lt;li&gt;Search the code. In your project (or ask your AI builder to list them), search every file for the same words plus the actual test email and password, seed scripts, .env files, README notes and comments. Look for signInWithPassword or signIn calls with fixed values, a fake user object such as { id: &amp;#x27;demo&amp;#x27;, role: &amp;#x27;admin&amp;#x27; } set when there is no session, and route guards that return true when a flag is set.&lt;/li&gt;&lt;li&gt;Remove the shortcut instead of hiding it. Delete auto-login code, prefilled credentials, demo buttons and fake-session fallbacks. If you truly need a dev-only helper, keep it inside if (import.meta.env.DEV) in Vite (that code is tree-shaken from production builds) or behind process.env.NODE_ENV checks on the server, never behind a VITE_ or NEXT_PUBLIC_ flag that ships in the bundle. Never put a password in a VITE_ or NEXT_PUBLIC_ variable.&lt;/li&gt;&lt;li&gt;Make every protected page and API check a real session on the server. If the app &amp;#x27;worked&amp;#x27; because the guard was bypassed, the fix is not a better bypass: the database and every API route must reject requests without a valid user (Row Level Security in Supabase, a session check in each route or Server Action). See the related admin page fix.&lt;/li&gt;&lt;li&gt;Deal with the test accounts. In Supabase go to Authentication &amp;gt; Users and delete demo, test and admin accounts you do not need (or call auth.admin.deleteUser() from the server). Supabase notes that deleting a user removes their sessions, but an access token already issued stays valid until it expires. If you need to keep an account, give it a long unique password and no admin role. Check your own users or roles table for leftover admin rows too.&lt;/li&gt;&lt;li&gt;Rotate anything that was exposed. If the test password is also used anywhere else, change it there. If API keys, a service role key or database passwords sat next to the demo login in the code or repo, rotate them now: GitHub&amp;#x27;s guidance is that revoking or rotating a leaked secret comes first, and rewriting git history alone does not make it safe (forks and clones keep the old commits).&lt;/li&gt;&lt;li&gt;Close preview doors too. Preview and staging deployments are public URLs unless protected. On Vercel, Standard Protection (Vercel Authentication) is available on every plan and keeps preview URLs private. Do not share a preview link that has auto-login turned on.&lt;/li&gt;&lt;li&gt;Verify and keep it out. Rebuild, redeploy and repeat step 1 in a private window: you should see the normal login page, no prefilled fields, and no demo credentials in the bundle. Try the old test email and password: it should fail. Add the search words from step 1 to your pre-publish checklist and ask your AI builder to never add login shortcuts without a dev-only guard.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://owasp.org/Top10/2025/A07_2025-Authentication_Failures/&quot;&gt;OWASP Top 10:2025 A07 Authentication Failures (no default credentials)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://owasp.org/www-project-web-security-testing-guide/v42/4-Web_Application_Security_Testing/04-Authentication_Testing/02-Testing_for_Default_Credentials&quot;&gt;OWASP WSTG: Testing for Default Credentials (back doors left for testing)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://cwe.mitre.org/data/definitions/798.html&quot;&gt;CWE-798: Use of Hard-coded Credentials&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://cwe.mitre.org/data/definitions/489.html&quot;&gt;CWE-489: Active Debug Code&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://vite.dev/guide/env-and-mode&quot;&gt;Vite: Env Variables and Modes (import.meta.env.DEV, VITE_ prefix)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://nextjs.org/docs/app/guides/environment-variables&quot;&gt;Next.js: Environment Variables (NEXT_PUBLIC_ inlined at build)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/auth/managing-user-data&quot;&gt;Supabase: User Management (deleting users, sessions)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/removing-sensitive-data-from-a-repository&quot;&gt;GitHub: Removing sensitive data from a repository (rotate first)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://vercel.com/docs/deployment-protection&quot;&gt;Vercel: Deployment Protection (Standard Protection for previews)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/preview-auto-login-hardcoded-credentials-left-in-production.html&quot;&gt;Demo login, auto-login or hard-coded test credentials left in your live app&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Replit app shows 502 Bad Gateway after republishing (or publish fails at the last step)</title><link>https://unbreakmyapp.vercel.app/fixes/replit-publish-502-bad-gateway-after-republish.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/replit-publish-502-bad-gateway-after-republish.html</guid><pubDate>Sun, 22 Nov 2026 06:00:00 +0000</pubDate><category>Deploys</category><category>Replit</category><description>Your Replit app worked, you republished, and now the replit.app URL shows 502 Bad Gateway or the publish fails at the last step. Read the deploy logs, check host 0.0.0.0, one external port, production secrets and the 5 second health check, then republish a known-good version.</description><content:encoded>&lt;p&gt;Your Replit app worked, you republished, and now the replit.app URL shows 502 Bad Gateway or the publish fails at the last step. Read the deploy logs, check host 0.0.0.0, one external port, production secrets and the 5 second health check, then republish a known-good version.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;My published replit.app URL (or custom domain) returns 502 Bad Gateway right after I republished / Preview works but the live app is a 502 / publishing gets stuck or fails at the final Promote step / the app was fine yesterday and broke after the Agent&amp;#x27;s last change and a republish&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;A 502 Bad Gateway means a proxy in front of your app did not get a valid response from the server behind it (MDN). On Replit that server is your own app process, so a 502 after a republish almost always means the new version is not answering: it crashed on startup, it is listening on the wrong address or port, or it is too slow to respond. Replit&amp;#x27;s troubleshooting guide lists the usual causes. The server must listen on 0.0.0.0 (localhost or 127.0.0.1 does not work for published apps). If you set ports in .replit, automatic port detection is turned off and one port needs externalPort = 80, and Autoscale and Reserved VM apps can only expose a single external port. The app must keep running (a script that runs once and exits gets restarted). Before switching the live URL to a new version, Replit sends it an HTTP request, and if your homepage takes more than five seconds to respond the health check can time out and the publish fails at the final step. A very common trigger in vibe-coded apps is an Agent change that only works in the editor: a new environment variable or secret that the published app does not have, a database call at startup that fails against the production database, or a new dev server command. Replit&amp;#x27;s docs also say the published app&amp;#x27;s file system resets on every publish, so files the app wrote to disk are gone. Replit does not give you a one-click rollback of a published version: its docs say you are responsible for tracking tested, healthy releases (each publish creates a Published your App commit and the deploy logs show the Build ID and Deployment ID, kept for 30 days).&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Confirm it is your app and not your network. Open the live URL in a private window and on mobile data. Replit&amp;#x27;s docs note that web filters or DNS can block replit.app and replit.dev domains; if only one network fails, try a public DNS resolver such as 1.1.1.1 or 8.8.8.8. If it fails everywhere, carry on.&lt;/li&gt;&lt;li&gt;Check that Preview still works. Select Run and open Preview. If Preview is broken too, publishing will not fix it: fix the app first. If Preview works and only the published app gives 502, the problem is publishing-specific.&lt;/li&gt;&lt;li&gt;Read the deploy logs before changing anything. Open Publishing and select View logs (or Tools &amp;gt; Publishing &amp;gt; Current status &amp;gt; View deploy logs), and look at the Logs in Monitoring with Errors only switched on. Look for a stack trace, &amp;#x27;Cannot find module&amp;#x27;, a missing variable, a database connection error or the process exiting. Monitoring&amp;#x27;s HTTP Statuses chart shows when the errors started, which tells you which publish caused them.&lt;/li&gt;&lt;li&gt;Check host and port. The server must listen on 0.0.0.0, not localhost or 127.0.0.1, and should use the port Replit gives it (process.env.PORT with a fallback). Open .replit: if it has [[ports]] entries, automatic port detection is off, so the port your server listens on must be the localPort of an entry with externalPort = 80. Autoscale and Reserved VM can only expose one external port, so remove extra exposed ports (for example a second dev server or a websocket port added by the Agent).&lt;/li&gt;&lt;li&gt;Check the run and build commands in the Publishing settings. A dev command (vite, next dev, npm run dev) or a wrong entry file often works in Preview but not when published. Use the production build command and a start command that starts a long-running web server.&lt;/li&gt;&lt;li&gt;Check production secrets. In Publishing, select Adjust settings and look at Production app secrets. Make sure every key the new code reads (database URL, Supabase, Stripe, OpenAI, auth secrets) is there with the production value. Replit&amp;#x27;s pages describe secret syncing differently, so check the actual values rather than assuming they copied over. An undefined secret read at startup crashes the server, which shows up as a 502.&lt;/li&gt;&lt;li&gt;Make the homepage answer fast. Replit&amp;#x27;s health check gives your homepage about five seconds. Do not run migrations, seed data, warm caches or call slow APIs before the server starts listening. Start the server first, keep the / route light, and move heavy work behind a user action or a background job.&lt;/li&gt;&lt;li&gt;Check the deployment type. If the app has API routes, logins, webhooks or server-side database calls, it needs Autoscale or Reserved VM, not Static. Static only serves files, so the backend parts will fail.&lt;/li&gt;&lt;li&gt;Go back to a known-good version if you cannot fix it quickly. There is no one-click deployment rollback, so roll back to the Agent checkpoint or Git commit from your last working publish (the Published your App commits in the Git pane help you find it) and publish again. Be careful: rolling back code does not restore production data. Then reapply the new change in small steps, checking Preview and the logs each time.&lt;/li&gt;&lt;li&gt;After it works, republish and verify the live URL, not Preview: load the homepage, log in, and run the main action. Note the Deployment ID and Git commit of this healthy release so you have a rollback point next time.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://docs.replit.com/build/troubleshooting&quot;&gt;Replit: Troubleshoot publishing&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.replit.com/features/publishing/after-you-publish&quot;&gt;Replit: After you publish (stages, deploy logs, rollback points)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.replit.com/features/publishing/monitoring-a-deployment&quot;&gt;Replit: Monitoring your app (logs, HTTP statuses)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.replit.com/features/project-setup/ports&quot;&gt;Replit: Ports (0.0.0.0, externalPort 80, single port)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.replit.com/core-concepts/project-editor/app-setup/secrets&quot;&gt;Replit: Secrets (production app secrets)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.replit.com/features/publishing/overview&quot;&gt;Replit: Publishing overview (deployment settings)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.replit.com/features/publishing/deployment-types&quot;&gt;Replit: Deployment types&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.replit.com/features/version-control/checkpoints-and-rollbacks&quot;&gt;Replit: Checkpoints and Rollbacks&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/502&quot;&gt;MDN: 502 Bad Gateway&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/replit-publish-502-bad-gateway-after-republish.html&quot;&gt;Replit app shows 502 Bad Gateway after republishing (or publish fails at the last step)&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Missing security headers (CSP, X-Frame-Options, nosniff) on a Vercel or Netlify app</title><link>https://unbreakmyapp.vercel.app/fixes/missing-security-headers-csp-vercel-netlify.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/missing-security-headers-csp-vercel-netlify.html</guid><pubDate>Thu, 19 Nov 2026 06:00:00 +0000</pubDate><category>Deploys</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><category>Replit</category><category>v0</category><description>A security scan says your vibe-coded app is missing Content-Security-Policy, X-Frame-Options or X-Content-Type-Options. Add the safe headers on your host (vercel.json, Netlify _headers or next.config.js), then roll out CSP in report-only mode first so nothing breaks.</description><content:encoded>&lt;p&gt;A security scan says your vibe-coded app is missing Content-Security-Policy, X-Frame-Options or X-Content-Type-Options. Add the safe headers on your host (vercel.json, Netlify _headers or next.config.js), then roll out CSP in report-only mode first so nothing breaks.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Mozilla HTTP Observatory, a security scanner or a client&amp;#x27;s security review flags your app: &amp;#x27;Content-Security-Policy (CSP) header not implemented&amp;#x27; / &amp;#x27;X-Frame-Options header not set&amp;#x27; or &amp;#x27;clickjacking: page can be framed&amp;#x27; / &amp;#x27;X-Content-Type-Options header missing&amp;#x27; / &amp;#x27;Referrer-Policy not set&amp;#x27; / &amp;#x27;Server leaks version information via X-Powered-By&amp;#x27; / you added a CSP and now the console shows &amp;#x27;Refused to load the script because it violates the following Content Security Policy directive&amp;#x27; and the page is blank&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;AI builders like Lovable, Bolt, Cursor, Replit and v0 generate the app code, but security response headers are set by the server or host, so the default deploy usually ships without most of them. Browsers only apply these protections when the server sends the header. Without Content-Security-Policy, any script injected through an XSS bug can run and send data anywhere. Without X-Frame-Options or the CSP frame-ancestors directive, another site can load your login or payment page in a hidden iframe (clickjacking). Without X-Content-Type-Options: nosniff, browsers may guess file types, which OWASP says can turn non-executable content into executable content. Next.js also sends an X-Powered-By header by default, which OWASP recommends removing because it tells attackers your stack. Some protections may already be there: Vercel sends Strict-Transport-Security automatically (on *.vercel.app it is max-age=63072000; includeSubDomains; preload), so do not panic about HSTS on Vercel. The second trap is the opposite: an AI-written CSP pasted in all at once often blocks your own Supabase, Stripe or analytics requests and inline scripts, and the app goes blank.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;See what you send today. Run your live URL through Mozilla HTTP Observatory, or run curl -sI https://your-app.com and read the response headers. Note which of Content-Security-Policy, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy and Strict-Transport-Security are missing.&lt;/li&gt;&lt;li&gt;Add the safe headers first. These rarely break anything: X-Content-Type-Options: nosniff, Referrer-Policy: strict-origin-when-cross-origin, X-Frame-Options: DENY (use SAMEORIGIN only if your own site frames itself), and Permissions-Policy: camera=(), microphone=(), geolocation=() with any feature your app really uses removed from the list. OWASP recommends these values. OWASP also says not to rely on X-XSS-Protection; set it to 0 or leave it out (some older examples still show 1; mode=block).&lt;/li&gt;&lt;li&gt;Put them where your host reads them. On Vercel (static, Vite or any framework) add a headers entry with source &amp;quot;/(.*)&amp;quot; in vercel.json. On Netlify add a _headers file in the publish folder with a /* block, or [[headers]] for = &amp;quot;/*&amp;quot; in netlify.toml. Netlify notes these custom headers do not apply to responses from functions, edge functions or SSR pages, so set headers in that code too. In Next.js use async headers() in next.config.js and set poweredByHeader: false to drop X-Powered-By. If your builder&amp;#x27;s own hosting does not let you set headers, a proxy such as Cloudflare Response Header Transform Rules can add them.&lt;/li&gt;&lt;li&gt;Start CSP in report-only mode. Send Content-Security-Policy-Report-Only first: the browser reports violations in the console (and to a report-to endpoint if you add one) but blocks nothing. A starting policy: default-src &amp;#x27;self&amp;#x27;; script-src &amp;#x27;self&amp;#x27;; connect-src &amp;#x27;self&amp;#x27; https://YOUR-PROJECT.supabase.co wss://YOUR-PROJECT.supabase.co; img-src &amp;#x27;self&amp;#x27; data: blob:; object-src &amp;#x27;none&amp;#x27;; base-uri &amp;#x27;self&amp;#x27;; form-action &amp;#x27;self&amp;#x27;; frame-ancestors &amp;#x27;none&amp;#x27;. Add each third party you really use (Stripe.js, analytics, fonts) as the console shows it.&lt;/li&gt;&lt;li&gt;Fix the violations instead of loosening the policy. Move inline scripts into files, or use a nonce (Next.js generates a fresh nonce per request in Proxy, which means those pages render dynamically) or a hash. Avoid &amp;#x27;unsafe-inline&amp;#x27; and &amp;#x27;unsafe-eval&amp;#x27; in script-src, as Vercel&amp;#x27;s CSP guide advises; React and Next.js do not need &amp;#x27;unsafe-eval&amp;#x27; in production. Never use * as a source.&lt;/li&gt;&lt;li&gt;Switch to enforcing. When a few days of normal use show no unexpected violations, rename the header to Content-Security-Policy. Note that frame-ancestors and the report-only header do not work in a &amp;lt;meta&amp;gt; tag, so set them as real HTTP headers. Then rerun Observatory and curl -sI, and test login, checkout and file uploads in a private window.&lt;/li&gt;&lt;li&gt;Remember what headers do not fix. Headers reduce the damage of XSS and clickjacking, but they do not protect your data. Missing Row Level Security, leaked keys or admin checks done only in the browser still need their own fixes (see the related pages).&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://cheatsheetseries.owasp.org/cheatsheets/HTTP_Headers_Cheat_Sheet.html&quot;&gt;OWASP: HTTP Security Response Headers Cheat Sheet&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://cheatsheetseries.owasp.org/cheatsheets/Content_Security_Policy_Cheat_Sheet.html&quot;&gt;OWASP: Content Security Policy Cheat Sheet&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Security-Policy-Report-Only&quot;&gt;MDN: Content-Security-Policy-Report-Only&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Security-Policy/frame-ancestors&quot;&gt;MDN: CSP frame-ancestors (not supported in meta)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/observatory&quot;&gt;Mozilla HTTP Observatory&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://vercel.com/docs/headers/security-headers&quot;&gt;Vercel: Content Security Policy&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://vercel.com/docs/project-configuration/vercel-json#headers&quot;&gt;Vercel: vercel.json headers&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://vercel.com/docs/cdn-security/encryption&quot;&gt;Vercel: Encryption and TLS (automatic HSTS)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.netlify.com/manage/routing/headers/&quot;&gt;Netlify: Custom headers (_headers and netlify.toml)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://nextjs.org/docs/app/api-reference/config/next-config-js/headers&quot;&gt;Next.js: headers in next.config.js&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://nextjs.org/docs/app/api-reference/config/next-config-js/poweredByHeader&quot;&gt;Next.js: poweredByHeader (X-Powered-By)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://nextjs.org/docs/app/guides/content-security-policy&quot;&gt;Next.js: Content Security Policy guide (nonces)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://developers.cloudflare.com/rules/transform/response-header-modification/&quot;&gt;Cloudflare: Response Header Transform Rules&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/missing-security-headers-csp-vercel-netlify.html&quot;&gt;Missing security headers (CSP, X-Frame-Options, nosniff) on a Vercel or Netlify app&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Admin page is hidden but not protected (anyone can open /admin or call admin APIs)</title><link>https://unbreakmyapp.vercel.app/fixes/admin-page-hidden-but-not-protected-server-side-check.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/admin-page-hidden-but-not-protected-server-side-check.html</guid><pubDate>Wed, 18 Nov 2026 06:00:00 +0000</pubDate><category>Auth</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><category>Replit</category><category>v0</category><description>Your admin link is hidden for normal users, but anyone who types /admin or calls the API still gets in. Hiding a button is not security. Check the admin role on the server and in Supabase RLS on every request, and test it logged out.</description><content:encoded>&lt;p&gt;Your admin link is hidden for normal users, but anyone who types /admin or calls the API still gets in. Hiding a button is not security. Check the admin role on the server and in Supabase RLS on every request, and test it logged out.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;A normal user (or a logged-out visitor) types https://your-app.com/admin and the admin dashboard loads / the Admin link is hidden in the menu but the page still opens by URL / the admin page shows a &amp;#x27;not authorized&amp;#x27; message but DevTools &amp;gt; Network shows the full list of users, orders or emails was already downloaded / curl to an admin API route or Edge Function works without an admin login / a scanner or security review reports broken access control, force browsing or missing server-side authorization&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;When you ask Lovable, Bolt, Cursor, Replit or v0 for an admin area, the quick version usually checks the role in the browser: something like if (user.role !== &amp;#x27;admin&amp;#x27;) return null, a hidden menu item, or a redirect in a React component or route guard. That only changes what the screen shows. The page code, and any API it calls, are still reachable by anyone who types the URL, edits the JavaScript, or sends the request with curl. OWASP lists exactly this in A01:2025 Broken Access Control, the number one risk in its Top 10: access control is only effective in trusted server-side code, and an app that puts all of its access control in its front end can be bypassed by calling the admin URL from the command line. In a Supabase app the real gate is the database: if the admin page reads tables with the publishable key and Row Level Security lets any signed-in user (or anon) read every row, then hiding the page protects nothing, because the same data can be fetched directly. Next.js adds two traps. Its authentication guide says returning null in a layout is not recommended because nested routes and Server Actions have their own entry points, that Server Actions must be treated like public API endpoints with their own checks, and that middleware (called Proxy in newer versions) should not be your only line of defense; in March 2025 advisory GHSA-f82v-jwr5-mffw (CVE-2025-29927) showed authorization done only in middleware could be bypassed on self-hosted Next.js before 15.2.3, 14.2.25, 13.5.9 and 12.3.5 (Vercel-hosted deployments were automatically protected). The second trap is where the role comes from: Supabase warns that user_metadata can be changed by the signed-in user, and that the session returned by getSession() on the server should not be trusted for authorization decisions on its own.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Prove it first. Open a private window, stay logged out, and go straight to /admin (and any other admin URLs such as /dashboard/admin or /admin/users). Then log in as a normal test user and try again. Watch DevTools &amp;gt; Network: if any request returns other users&amp;#x27; rows, emails or orders, the data is exposed even if the screen says &amp;#x27;not authorized&amp;#x27;.&lt;/li&gt;&lt;li&gt;Store the admin role where users cannot change it. Use a separate table such as public.user_roles (user_id, role) that only you or a server-side process can write, or app_metadata set with the service role. Never decide admin rights from user_metadata, a localStorage flag, a query parameter, or a role column the user can update on their own profile row.&lt;/li&gt;&lt;li&gt;Protect the data in the database, not the page. Create a security definer helper such as public.is_admin() that checks user_roles for (select auth.uid()), with set search_path = &amp;#x27;&amp;#x27;, and use it in RLS policies: admins can read or change everything they need, normal users only their own rows, anon nothing. Revoke direct access to user_roles from anon and authenticated so nobody can grant themselves the role. Supabase&amp;#x27;s RBAC guide shows the same idea with a custom user_role claim added by a Custom Access Token Hook.&lt;/li&gt;&lt;li&gt;Check the role on the server for every admin action. In each admin API route, Route Handler, Server Action or Supabase Edge Function, verify the caller&amp;#x27;s token on the server (Supabase recommends getClaims() or getUser(), not the user object from getSession()), look up the role, and return 401 if there is no valid session and 403 if the user is not an admin, before any database work. Do admin-only writes with the service role key only inside that server code, after the check, and never ship that key to the browser.&lt;/li&gt;&lt;li&gt;Keep the frontend check, but only for comfort. Hiding the menu item and redirecting non-admins from /admin is fine for a clean UI, and Next.js calls this an optimistic check. It must never be the only check. In Next.js, do not rely on a layout that returns null or on middleware alone; put the check in a shared data access layer that every admin page, Route Handler and Server Action calls.&lt;/li&gt;&lt;li&gt;If you self-host Next.js, make sure you are on a patched version (15.2.3, 14.2.25, 13.5.9, 12.3.5 or later) for the middleware bypass advisory, or block incoming requests that carry the x-middleware-subrequest header as the advisory suggests.&lt;/li&gt;&lt;li&gt;Test it like an attacker, and keep the test. Repeat step 1 logged out and as a normal user, then call each admin API or Edge Function with curl using a normal user&amp;#x27;s token: every one must return 401 or 403 and no data. Add these as automated tests so a future AI edit cannot quietly remove the server-side check.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://owasp.org/Top10/2025/A01_2025-Broken_Access_Control/&quot;&gt;OWASP Top 10:2025 A01 Broken Access Control&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://cheatsheetseries.owasp.org/cheatsheets/Authorization_Cheat_Sheet.html&quot;&gt;OWASP Authorization Cheat Sheet (deny by default, validate permissions on every request)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://owasp.org/www-project-web-security-testing-guide/stable/4-Web_Application_Security_Testing/05-Authorization_Testing/02-Testing_for_Bypassing_Authorization_Schema&quot;&gt;OWASP WSTG: Testing for Bypassing Authorization Schema&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://nextjs.org/docs/app/guides/authentication&quot;&gt;Next.js: Authentication guide (optimistic vs secure checks, Data Access Layer, Server Actions)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://github.com/vercel/next.js/security/advisories/GHSA-f82v-jwr5-mffw&quot;&gt;Next.js advisory GHSA-f82v-jwr5-mffw (CVE-2025-29927, middleware authorization bypass)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/postgres/custom-claims-and-role-based-access-control-rbac&quot;&gt;Supabase: Custom Claims and Role-based Access Control (RBAC)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/postgres/row-level-security&quot;&gt;Supabase: Row Level Security (auth.jwt, user_metadata vs app_metadata)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/auth/server-side/nextjs&quot;&gt;Supabase: Server-side auth for Next.js (getClaims vs getUser vs getSession)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/functions/auth&quot;&gt;Supabase: Securing Edge Functions&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/admin-page-hidden-but-not-protected-server-side-check.html&quot;&gt;Admin page is hidden but not protected (anyone can open /admin or call admin APIs)&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Stripe webhook returns 401 from a Supabase Edge Function (Missing authorization header / Invalid JWT)</title><link>https://unbreakmyapp.vercel.app/fixes/stripe-webhook-401-supabase-edge-function-jwt-verification.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/stripe-webhook-401-supabase-edge-function-jwt-verification.html</guid><pubDate>Tue, 17 Nov 2026 06:00:00 +0000</pubDate><category>Payments</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><category>Replit</category><category>v0</category><description>Stripe shows 401 for every webhook to your Supabase Edge Function? Stripe sends no Supabase JWT, so the platform check rejects it before your code runs. Turn off verify_jwt for that one function and verify the Stripe signature instead.</description><content:encoded>&lt;p&gt;Stripe shows 401 for every webhook to your Supabase Edge Function? Stripe sends no Supabase JWT, so the platform check rejects it before your code runs. Turn off verify_jwt for that one function and verify the Stripe signature instead.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Stripe Dashboard &amp;gt; Webhooks shows every delivery to https://&amp;lt;project-ref&amp;gt;.supabase.co/functions/v1/stripe-webhook failing with 401 / response body {&amp;quot;code&amp;quot;:401,&amp;quot;message&amp;quot;:&amp;quot;Missing authorization header&amp;quot;} or &amp;quot;Invalid JWT&amp;quot; or &amp;quot;Invalid Token or Protected Header formatting&amp;quot; / the Edge Function logs show no console output at all / payment succeeds but the order, credits or subscription never update in the app&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;Supabase Edge Functions have a built-in JWT check (verify_jwt) that runs before your code. It is on by default, and Supabase&amp;#x27;s 401 troubleshooting guide says that when it fails your function never executes and the platform answers 401 with &amp;#x27;Invalid JWT&amp;#x27; or &amp;#x27;Missing authorization header&amp;#x27; itself. That is fine when your own app calls the function, because supabase.functions.invoke() sends the signed-in user&amp;#x27;s token. Stripe does not. Supabase&amp;#x27;s Function Configuration guide says it plainly: Stripe webhooks need to be publicly accessible because Stripe doesn&amp;#x27;t have your user tokens. Stripe signs each request with your whsec_ signing secret in the Stripe-Signature header instead. So when Lovable, Bolt, Cursor, Replit or v0 writes and deploys a stripe-webhook function with the default settings, every Stripe delivery is rejected at the door, your handler (and its console.log lines) never runs, and Stripe&amp;#x27;s Event deliveries list shows 401, which Stripe&amp;#x27;s docs describe as the destination URL having access restrictions. The same 401 can also come from projects using Supabase&amp;#x27;s newer API keys, because Supabase says the legacy check only understands the legacy key format. Stripe keeps retrying failed live deliveries for up to three days with exponential back off (sandbox events are retried three times over a few hours), so nothing is lost yet if you fix it quickly, but paid customers will not get what they paid for until you do. The wrong fixes AI builders often suggest are putting your anon or service_role key into the webhook URL (Stripe only sends its own Stripe-Signature header, and a secret key must never sit in a URL) or turning verify_jwt off for every function.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Confirm it is the platform check. In Stripe, open Workbench &amp;gt; Webhooks, pick your endpoint and open a failed delivery: a 401 with a body of {&amp;quot;code&amp;quot;:401,&amp;quot;message&amp;quot;:&amp;quot;Missing authorization header&amp;quot;} or &amp;#x27;Invalid JWT&amp;#x27; comes from Supabase, not your code. In Supabase, the function&amp;#x27;s Logs show the 401 invocation but none of your console.log output. If the body is your own message, your code returned the 401 itself, so search the function for status: 401.&lt;/li&gt;&lt;li&gt;Turn off the JWT check for the webhook function only. Add this to supabase/config.toml: [functions.stripe-webhook] with verify_jwt = false (use your function&amp;#x27;s real folder name). Or redeploy with: supabase functions deploy stripe-webhook --no-verify-jwt. Or, if you never use the CLI, open the function in the Supabase Dashboard (Edge Functions &amp;gt; your function &amp;gt; Details) and switch off JWT verification. Leave it on for functions your signed-in users call.&lt;/li&gt;&lt;li&gt;Make the config stick. The CLI verifies JWTs by default when it deploys a function without that setting, so if your AI builder redeploys without the config.toml block or the flag, the check can come back on and the 401s return. Keep the config.toml entry committed in the repo instead of relying on a one-off flag.&lt;/li&gt;&lt;li&gt;Now verify Stripe&amp;#x27;s signature inside the function, because with the check off anyone can call the URL. Read the raw body with await req.text() (never req.json() first), take the stripe-signature header, and call await stripe.webhooks.constructEventAsync(body, signature, Deno.env.get(&amp;#x27;STRIPE_WEBHOOK_SECRET&amp;#x27;), undefined, Stripe.createSubtleCryptoProvider()). Supabase notes the synchronous constructEvent() fails on the Deno runtime. Return 400 if verification throws and do no database work.&lt;/li&gt;&lt;li&gt;Store the secrets as Edge Function secrets, not in code: supabase secrets set STRIPE_SECRET_KEY=sk_test_... STRIPE_WEBHOOK_SECRET=whsec_... The whsec_ value comes from the endpoint&amp;#x27;s page in Stripe (Reveal secret). Each endpoint has its own secret, test and live endpoints are separate, and stripe listen prints a different one.&lt;/li&gt;&lt;li&gt;Return 2xx quickly. Stripe says your endpoint must return a successful status before any slow work. Verify, record the event id so retries are not processed twice, update the order with a service-role client inside the function, then return 200 { received: true }.&lt;/li&gt;&lt;li&gt;Replay what was missed. In Stripe, open a failed event and click Resend (the Dashboard allows this for up to 15 days after the event), or run stripe events resend &amp;lt;event_id&amp;gt; --webhook-endpoint=&amp;lt;endpoint_id&amp;gt; (up to 30 days). Then check that every paid customer now has their order, credits or plan.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/kb/troubleshooting/edge-function-401-error-response&quot;&gt;Supabase: Edge Function 401 error response&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/functions/function-configuration&quot;&gt;Supabase: Function Configuration (verify_jwt for Stripe webhooks)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/functions/auth&quot;&gt;Supabase: Securing Edge Functions (external webhooks)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/functions/examples/stripe-webhooks&quot;&gt;Supabase: Handling Stripe Webhooks with Edge Functions&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.stripe.com/webhooks&quot;&gt;Stripe: Receive webhook events (status codes, retries, resend)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.stripe.com/webhooks/signature&quot;&gt;Stripe: Verify webhook signatures&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/stripe-webhook-401-supabase-edge-function-jwt-verification.html&quot;&gt;Stripe webhook returns 401 from a Supabase Edge Function (Missing authorization header / Invalid JWT)&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Is my Lovable app leaking data without login? A Supabase RLS audit checklist after the Crissy Field study</title><link>https://unbreakmyapp.vercel.app/fixes/lovable-app-leaking-data-without-login-audit-checklist.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/lovable-app-leaking-data-without-login-audit-checklist.html</guid><pubDate>Mon, 16 Nov 2026 06:00:00 +0000</pubDate><category>Database / Supabase RLS</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><category>Replit</category><category>v0</category><description>Check in 10 minutes whether your Lovable, Bolt, Cursor, Replit or v0 app shows Supabase data to visitors who never log in, then close it with RLS, grants and private buckets. Includes the verified Crissy Field study numbers.</description><content:encoded>&lt;p&gt;Check in 10 minutes whether your Lovable, Bolt, Cursor, Replit or v0 app shows Supabase data to visitors who never log in, then close it with RLS, grants and private buckets. Includes the verified Crissy Field study numbers.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;News: a study found thousands of Lovable apps returning Supabase records to visitors who never logged in / Lovable Quick scan or Supabase Security Advisor flags a table without row-level security or an access rule that lets everyone through / a logged-out browser tab shows other people&amp;#x27;s names, emails or orders in the Network tab / I am not sure whether my published app exposes customer data&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;In November 2026 the German security firm Crissy Field, working with Handelsblatt, published a study of 159,041 Lovable projects it found in Common Crawl data from December 2025 to September 2026. 34,545 of them used Supabase, and 24,664 sites sent Supabase records as soon as the page loaded, with no login. The researchers point out that this alone is not a problem, because some data is meant to be public. But with further read-only requests using the same public API key they found records containing email addresses in 10,560 tables across 7,403 of those 24,664 sites, with examples including passport numbers, chat messages, ticket and payment details and internal emails. They stress that their 30% figure is not a confirmed leak rate and that the sample is not representative of all Lovable apps. Nothing was hacked: the cause is the same database setting covered across this site. A Lovable, Bolt, Cursor, Replit or v0 app that talks to Supabase from the browser ships the publishable (or legacy anon) key in its code, and Supabase says anyone can read that key, so it only reaches what Row Level Security allows. Supabase also warns that a table in an exposed schema without RLS is readable and writable by any role with a grant on it. So the leak happens when a table has RLS switched off, has a policy that uses (true) for everyone, is read through a view that bypasses RLS, or sits in a public storage bucket. Lovable&amp;#x27;s own docs say its Quick and Deep security scans help find common issues but cannot guarantee complete security, and that you are responsible for your app&amp;#x27;s security. The audit below takes about ten minutes per app and only uses your own app and your own Supabase dashboard.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Only test apps you own or are allowed to test. Open your published app in a private (incognito) window without logging in, open DevTools &amp;gt; Network, filter by &amp;#x27;rest/v1&amp;#x27; and click through every public page. Read each response: anything other than data you meant to be public (names, emails, phone numbers, orders, messages, files) is a leak.&lt;/li&gt;&lt;li&gt;Try the tables your app does not show. Copy your project URL and publishable key from the app&amp;#x27;s code or the Settings &amp;gt; API Keys section of the Supabase Dashboard, then for each table run: curl &amp;#x27;https://&amp;lt;project-ref&amp;gt;.supabase.co/rest/v1/&amp;lt;table&amp;gt;?select=*&amp;amp;limit=1&amp;#x27; -H &amp;#x27;apikey: &amp;lt;publishable key&amp;gt;&amp;#x27;. Supabase says to send publishable keys on the apikey header. Any row that comes back is readable by every visitor on the internet. An empty list [] or a 401 or 42501 error means that table is closed to logged-out users.&lt;/li&gt;&lt;li&gt;Run the built-in scanners. In Supabase open Advisors &amp;gt; Security Advisor and fix every 0013 rls_disabled_in_public, 0007 policy_exists_rls_disabled, 0024 permissive_rls_policy, 0010 security_definer_view and 0002 auth_users_exposed finding. In Lovable, open the project Security view and run the Deep scan as well as the Quick scan that runs when you publish. Treat a clean scan as a minimum, not proof.&lt;/li&gt;&lt;li&gt;Turn RLS on for every table in the public schema: alter table public.&amp;lt;table&amp;gt; enable row level security; Then list what is still open with select tablename, rowsecurity from pg_tables where schemaname = &amp;#x27;public&amp;#x27;; and review every policy in Lovable under More &amp;gt; Database &amp;gt; Manage &amp;gt; Policies or on the policies page of the Supabase Dashboard.&lt;/li&gt;&lt;li&gt;Replace open policies. Any policy whose USING or WITH CHECK is just true, or that applies to the anon role on a table holding personal data, lets everyone through. Rewrite it to check ownership, for example using ((select auth.uid()) = user_id), and keep public read access only on tables that really are public, such as published blog posts.&lt;/li&gt;&lt;li&gt;Remove grants you do not need. Supabase now advises that on projects that still grant anon and authenticated by default you revoke those grants, because adding policies does not take them back: revoke all on table public.&amp;lt;table&amp;gt; from anon, authenticated; then grant back only what each role needs, for example grant select, insert on table public.&amp;lt;table&amp;gt; to authenticated;&lt;/li&gt;&lt;li&gt;Check the other doors: views (set security_invoker = true or move them out of the public schema), storage buckets (Supabase says anyone with the URL can read files in a public bucket, so keep IDs, invoices and private photos in a private bucket with storage policies), and any place an AI shortcut put the service_role or sb_secret_ key into browser code.&lt;/li&gt;&lt;li&gt;Test as two different users. Sign up two test accounts and confirm that account A cannot read, edit or delete account B&amp;#x27;s rows, either in the app or with the curl test above using A&amp;#x27;s access token. Lovable&amp;#x27;s own pre-publish checklist asks you to verify that users cannot access other users&amp;#x27; private data. Also check that a normal user cannot make themselves admin or Pro.&lt;/li&gt;&lt;li&gt;Repeat the logged-out tests from steps 1 and 2. Every private table should now return [] or an error. If real customer data was exposed before you fixed it, check your Supabase logs for unknown access, rotate any keys stored in tables, and follow your privacy obligations for notifying affected people (see our first-steps guide for a reported security hole).&lt;/li&gt;&lt;li&gt;Keep it fixed: add a project rule that every new table must enable RLS with owner-based policies in the same migration, re-run the Security Advisor and Lovable scan after every schema change, and re-do the logged-out test before each launch.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://www.crissyfield.de/research/lovable-en/&quot;&gt;Crissy Field: Lovable, Many Apps Built on the Platform Expose Sensitive Data (study)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.lovable.dev/features/security&quot;&gt;Lovable: Security overview (Quick scan and Deep scan)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.lovable.dev/tips-tricks/security-best-practices&quot;&gt;Lovable: Security best practices (checklist before publishing)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/postgres/row-level-security&quot;&gt;Supabase: Row Level Security&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/api/api-keys&quot;&gt;Supabase: API keys (publishable vs secret, apikey header)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/api/securing-your-api&quot;&gt;Supabase: Securing your API&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/database-advisors&quot;&gt;Supabase: Database Advisors (Security Advisor lints)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/storage/buckets/fundamentals&quot;&gt;Supabase Storage: Bucket fundamentals (public buckets)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/lovable-app-leaking-data-without-login-audit-checklist.html&quot;&gt;Is my Lovable app leaking data without login? A Supabase RLS audit checklist after the Crissy Field study&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Any user can make themselves admin or Pro: Supabase RLS lets users update their own role, plan or is_admin column</title><link>https://unbreakmyapp.vercel.app/fixes/users-can-update-own-plan-or-role-column.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/users-can-update-own-plan-or-role-column.html</guid><pubDate>Sun, 15 Nov 2026 06:00:00 +0000</pubDate><category>Database / Supabase RLS</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><category>Replit</category><category>v0</category><description>Row Level Security decides which rows a user can touch, not which columns. A typical AI-generated policy such as create policy &quot;Users can update own profile&quot; on profiles for update using ((select auth.uid()) = id) is correct for the row, but it lets the owner change every column in that row.</description><content:encoded>&lt;p&gt;Row Level Security decides which rows a user can touch, not which columns. A typical AI-generated policy such as create policy &amp;quot;Users can update own profile&amp;quot; on profiles for update using ((select auth.uid()) = id) is correct for the row, but it lets the owner change every column in that row.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;A user changed their own role to &amp;#x27;admin&amp;#x27;, is_admin to true or plan to &amp;#x27;pro&amp;#x27; from the browser console / supabase.from(&amp;#x27;profiles&amp;#x27;).update({ role: &amp;#x27;admin&amp;#x27; }).eq(&amp;#x27;id&amp;#x27;, user.id) succeeds for a normal user / a security review says users can escalate privileges through the profiles table / free users unlocked paid features without paying&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;Row Level Security decides which rows a user can touch, not which columns. A typical AI-generated policy such as create policy &amp;quot;Users can update own profile&amp;quot; on profiles for update using ((select auth.uid()) = id) is correct for the row, but it lets the owner change every column in that row. If the same profiles table also holds role, is_admin, plan, credits or subscription_status, anyone who signs up can open the browser console, take your public anon or publishable key (it is meant to be public) and run update({ role: &amp;#x27;admin&amp;#x27; }) or update({ plan: &amp;#x27;pro&amp;#x27; }) on their own row. The policy passes, because it is their row. Supabase&amp;#x27;s Column Level Security guide shows exactly this: an owner UPDATE policy gives the post owner full access to update the row, including all of the columns, and by default the authenticated role has a table-level UPDATE privilege on every column. A WITH CHECK clause does not save you on its own either: Postgres checks WITH CHECK against the new row only, so it cannot ask &amp;#x27;did this column change?&amp;#x27;. The same trap exists outside tables: Supabase warns that raw_user_meta_data can be updated by the user with supabase.auth.updateUser() and is not a good place to store authorization data, while raw_app_meta_data cannot be changed by the user.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Test it first, as a normal signed-in user in the browser console of your live app: await supabase.from(&amp;#x27;profiles&amp;#x27;).update({ role: &amp;#x27;admin&amp;#x27; }).eq(&amp;#x27;id&amp;#x27;, (await supabase.auth.getUser()).data.user.id).select() (use your real table and column names, such as is_admin, plan or credits). If the row comes back with the new value, any user can do it. Change it back afterwards.&lt;/li&gt;&lt;li&gt;List every column that grants power or money: role, is_admin, plan, tier, credits, subscription_status, stripe_customer_id, trial_ends_at, approved, verified. These must only ever be written by your server (service role), a webhook or an admin, never by the user&amp;#x27;s own browser session.&lt;/li&gt;&lt;li&gt;Best fix, recommended by Supabase: move roles and plans out of the user-editable table. Create a separate table such as public.user_roles (user_id, role) or public.subscriptions, revoke all on it from anon and authenticated, and let only your server, Stripe webhook or a Custom Access Token Auth Hook write it. Users can still edit their name and avatar in profiles.&lt;/li&gt;&lt;li&gt;Quick fix if the columns must stay in profiles: use column-level privileges. revoke update on table public.profiles from anon, authenticated; then grant update (display_name, avatar_url, bio) on table public.profiles to authenticated; listing only the columns users may edit. Postgres warns that revoking one column while the table-level grant remains does nothing, so revoke the table-level UPDATE first. Do the same for INSERT if the browser inserts profile rows: revoke insert, then grant insert (id, display_name, avatar_url).&lt;/li&gt;&lt;li&gt;After the grant change, check your app code. Restricted roles must name their columns: an update or upsert that sends the whole profile object, including role or plan, will now fail with a permission denied error. Send only the editable fields. Only restrict UPDATE and INSERT here: Supabase warns that column restrictions can break select * on the table, so do not revoke SELECT on columns unless you need to hide them.&lt;/li&gt;&lt;li&gt;Alternative or extra guard, a trigger: a BEFORE UPDATE trigger can compare OLD and NEW, which a policy cannot. For example: create function public.protect_profile_columns() returns trigger language plpgsql as $$ begin if current_user in (&amp;#x27;anon&amp;#x27;,&amp;#x27;authenticated&amp;#x27;) and (new.role is distinct from old.role or new.plan is distinct from old.plan) then raise exception &amp;#x27;role and plan can only be changed by the server&amp;#x27;; end if; return new; end; $$; then create trigger protect_profile_columns before update on public.profiles for each row execute function public.protect_profile_columns(); Your service role key and the SQL editor still work.&lt;/li&gt;&lt;li&gt;Create profile rows server-side with a trigger on auth.users (Supabase&amp;#x27;s handle_new_user pattern) that sets role and plan to safe defaults, so a user cannot insert their own row with role &amp;#x27;admin&amp;#x27; either. If you keep a browser INSERT, add with check (role = &amp;#x27;user&amp;#x27; and plan = &amp;#x27;free&amp;#x27;) to the insert policy.&lt;/li&gt;&lt;li&gt;Never authorise from user_metadata. Policies or code that read auth.jwt() -&amp;gt; &amp;#x27;user_metadata&amp;#x27; -&amp;gt; &amp;#x27;role&amp;#x27; can be changed by the user with supabase.auth.updateUser(). Use raw_app_meta_data, a roles table, or a custom claim added by the Custom Access Token Auth Hook.&lt;/li&gt;&lt;li&gt;Re-run the console test from step 1. It should now fail with an error, while editing the display name still works. Then check who already has role &amp;#x27;admin&amp;#x27; or a paid plan without a matching Stripe payment, and fix those rows from the server.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/postgres/column-level-security&quot;&gt;Supabase: Column Level Security&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/postgres/row-level-security&quot;&gt;Supabase: Row Level Security (auth.jwt, user_metadata vs app_metadata)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/postgres/custom-claims-and-role-based-access-control-rbac&quot;&gt;Supabase: Custom Claims and Role-based Access Control (RBAC)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/auth/managing-user-data&quot;&gt;Supabase: User Management (profiles table trigger)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.postgresql.org/docs/current/sql-grant.html&quot;&gt;PostgreSQL: GRANT (column privileges)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.postgresql.org/docs/current/sql-createpolicy.html&quot;&gt;PostgreSQL: CREATE POLICY (USING and WITH CHECK for UPDATE)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.postgresql.org/docs/current/plpgsql-trigger.html&quot;&gt;PostgreSQL: Trigger functions in PL/pgSQL (OLD and NEW)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/users-can-update-own-plan-or-role-column.html&quot;&gt;Any user can make themselves admin or Pro: Supabase RLS lets users update their own role, plan or is_admin column&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Supabase view shows every user&#x27;s data even with RLS on: fix Security Advisor 0010 security_definer_view</title><link>https://unbreakmyapp.vercel.app/fixes/supabase-view-bypasses-rls-security-invoker.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/supabase-view-bypasses-rls-security-invoker.html</guid><pubDate>Thu, 12 Nov 2026 06:00:00 +0000</pubDate><category>Database / Supabase RLS</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><category>Replit</category><category>v0</category><description>In Postgres a view does not run as the person querying it by default. Supabase&#x27;s Security Advisor explains that views default to running with the permissions of the view&#x27;s creator, kept that way for backwards compatibility, and Supabase&#x27;s RLS guide says views bypass RLS by default because they are u</description><content:encoded>&lt;p&gt;In Postgres a view does not run as the person querying it by default. Supabase&amp;#x27;s Security Advisor explains that views default to running with the permissions of the view&amp;#x27;s creator, kept that way for backwards compatibility, and Supabase&amp;#x27;s RLS guide says views bypass RLS by default because they are u&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Security Advisor flags 0010 security_definer_view (View bypasses row-level security) or 0002 auth_users_exposed / my tables have RLS and owner policies but a view returns every user&amp;#x27;s rows / querying the view with the anon key returns data the table itself hides / an AI-generated dashboard or stats view leaks other users&amp;#x27; data&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;In Postgres a view does not run as the person querying it by default. Supabase&amp;#x27;s Security Advisor explains that views default to running with the permissions of the view&amp;#x27;s creator, kept that way for backwards compatibility, and Supabase&amp;#x27;s RLS guide says views bypass RLS by default because they are usually created with the postgres user, which can bypass row level security. So you can have RLS switched on and a perfect owner policy on the orders table, and a view such as create view public.order_summary as select * from orders still returns every user&amp;#x27;s orders to anyone holding your publishable or anon key, because views in the public schema are exposed through the Data API like tables. AI coding tools create these views all the time for dashboards, joins and &amp;#x27;latest activity&amp;#x27; lists, and the RLS check on the base table never runs. A view over auth.users is worse: Supabase lint 0002 auth_users_exposed warns it can hand every user&amp;#x27;s email and sign-in details to the whole internet. Materialized views can never respect RLS at all. The fix since Postgres 15 is the security_invoker option, which makes the view check the base tables&amp;#x27; privileges and RLS policies as the user running the query.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Open Advisors &amp;gt; Security Advisor in the Supabase Dashboard (or run supabase db advisors with the CLI) and note every view listed under 0010 security_definer_view, 0002 auth_users_exposed and 0016 materialized_view_in_api.&lt;/li&gt;&lt;li&gt;Prove the leak before fixing it. In your app or with curl, query the view as a normal signed-in user (or with only the publishable key) and check whether rows belonging to other users come back. That tells you what was exposed while the view was live.&lt;/li&gt;&lt;li&gt;Make each ordinary view respect RLS: alter view public.&amp;lt;view_name&amp;gt; set (security_invoker = true); or recreate it with create or replace view public.&amp;lt;view_name&amp;gt; with (security_invoker = true) as select ...; This needs Postgres 15 or later, which current Supabase projects use.&lt;/li&gt;&lt;li&gt;Check the base tables now behave as expected through the view. With security_invoker on, the caller needs SELECT on the view and on every underlying table, and the tables&amp;#x27; RLS policies apply. If the view now returns nothing, the base table is missing a SELECT policy for the authenticated role, for example create policy &amp;quot;owner can read&amp;quot; on public.orders for select to authenticated using ((select auth.uid()) = user_id);&lt;/li&gt;&lt;li&gt;If a view reads auth.users, replace it. Supabase recommends a public.profiles table filled by a trigger on auth.users with its own RLS, or a security_invoker view plus RLS on the data, instead of exposing auth.users directly. Only include the columns the app really needs.&lt;/li&gt;&lt;li&gt;For materialized views, which cannot respect RLS, remove API access: revoke select on public.&amp;lt;mat_view&amp;gt; from public, anon, authenticated; then serve the data through a function or a server route that checks the user first.&lt;/li&gt;&lt;li&gt;If a view is genuinely meant to be public (for example a published-posts list), keep it but make sure it only selects public columns and rows, and document why. Do not leave private columns in a public view.&lt;/li&gt;&lt;li&gt;Re-run Security Advisor until 0010 and 0002 are gone, then add a rule to your Lovable, Bolt, Cursor or Replit project instructions: &amp;#x27;Every view in the public schema must be created with (security_invoker = true); never create views on auth.users.&amp;#x27;&lt;/li&gt;&lt;li&gt;If other users&amp;#x27; data was readable while the view was live, check Logs &amp;gt; API in the Dashboard for requests to the view and decide whether users need to be told under your privacy obligations.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/database-advisors&quot;&gt;Supabase: Database Advisors (0010 security_definer_view, 0002 auth_users_exposed, 0016)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/postgres/row-level-security&quot;&gt;Supabase: Row Level Security (Views and RLS)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.postgresql.org/docs/current/sql-createview.html&quot;&gt;PostgreSQL: CREATE VIEW (security_invoker)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.postgresql.org/docs/current/sql-alterview.html&quot;&gt;PostgreSQL: ALTER VIEW&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/supabase-view-bypasses-rls-security-invoker.html&quot;&gt;Supabase view shows every user&amp;#x27;s data even with RLS on: fix Security Advisor 0010 security_definer_view&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Replit rollback did not bring my data back: how to restore the development or production database</title><link>https://unbreakmyapp.vercel.app/fixes/replit-rollback-does-not-restore-database.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/replit-rollback-does-not-restore-database.html</guid><pubDate>Wed, 11 Nov 2026 06:00:00 +0000</pubDate><category>Database / Supabase RLS</category><category>Replit</category><description>A Replit checkpoint can capture your files, Agent memory and your development database, but a rollback does not automatically restore everything.</description><content:encoded>&lt;p&gt;A Replit checkpoint can capture your files, Agent memory and your development database, but a rollback does not automatically restore everything.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;I rolled back to a Replit Agent checkpoint and the code is old again but the data is still wrong / rows the Agent deleted are still missing / my published app&amp;#x27;s live data did not change after Rollback to here / a Publish dropped a column or table and the data is gone&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;A Replit checkpoint can capture your files, Agent memory and your development database, but a rollback does not automatically restore everything. Replit&amp;#x27;s Checkpoints and Rollbacks guide says that by default rollbacks do not change your database: to include the development database you have to select Database under Additional rollback options before confirming. More importantly, checkpoint rollback never touches your production database, the separate database your published app uses. Production data has its own recovery tools: point-in-time recovery (PITR), on by default with a 7-day window (up to 28 days on Pro, Teams and Enterprise), and optional scheduled daily backups. Replit also says restoring the database does not change your code and rolling back code does not change production data, so people often roll back the code, republish, and find the live data still broken. A common cause of lost production data is the Publish step itself: when you publish, Replit applies your development schema changes to production, and answering &amp;#x27;No, create new column&amp;#x27; to a rename question drops the old column with its data. If your app uses an external database such as Supabase, Replit&amp;#x27;s rollback and publish do not manage it, so you need that provider&amp;#x27;s backups.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Stop making changes first. Do not ask the Agent to &amp;#x27;fix the data&amp;#x27;, do not publish again and do not run new migrations until you know which database lost data and when. Every extra write makes the restore point harder to pick.&lt;/li&gt;&lt;li&gt;Work out which database is wrong. In the Database tool, check whether the missing rows are in the Development database (what the Project Editor and Agent use) or the Production database (what your published app uses). Both use a variable called DATABASE_URL, but each environment has its own value, so the published app reads production even when the editor shows dev data.&lt;/li&gt;&lt;li&gt;Note the exact time the damage happened, in your local time zone: the Agent message that ran the change, or the publish that applied it. You need this to pick a checkpoint or a PITR timestamp before the damage.&lt;/li&gt;&lt;li&gt;Development database: open the Agent tab, find the checkpoint from just before the bad change, choose Rollback to here, and before confirming select Database under Additional rollback options. Read the confirmation dialog: it should list your development database as well as files and Agent memory. Replit keeps development database history for Agent checkpoints up to 7 days back. This also removes all code changes made after that checkpoint.&lt;/li&gt;&lt;li&gt;Production database: checkpoint rollback will never fix it. Before restoring, export what you have now (My Data, table menu, Export all to .csv/.json/.xlsx, or ask the Agent to export every table to CSV with its read-only production access), so data written since the incident is not lost.&lt;/li&gt;&lt;li&gt;Then restore production with point-in-time recovery: Database tool, select Production, Settings, expand Point-in-time recovery under Advanced, select Restore database..., enter a timestamp just before the damage (your local time zone, inside the recovery window) and select Restore. The restore replaces live data. You can restore to an earlier point afterwards but not forward, so check the time carefully.&lt;/li&gt;&lt;li&gt;If PITR is disabled or the moment is outside the window, check Scheduled backups (Settings, Scheduled backups under Advanced, View all backups, Restore). They are off by default and available on Core and higher plans. If neither exists, use your exports or contact Replit Support.&lt;/li&gt;&lt;li&gt;Line code and data up again. Restoring the database does not change your code. If the bad code caused the problem, roll back to the matching checkpoint (without the dev Database option if dev data is fine) and publish again, so the live app and its data come from the same moment.&lt;/li&gt;&lt;li&gt;Re-add any real user data written after the restore point from the export you took, for example orders or sign-ups. Check payments against Stripe or your payment provider, which keeps its own records.&lt;/li&gt;&lt;li&gt;Prevent it next time: read the Generated migrations SQL in the Publish pane before every publish, answer &amp;#x27;Yes, rename column&amp;#x27; when a column or table was really renamed, treat an orange data-loss warning as a stop sign, consider a longer PITR window or scheduled backups for real user data, and if you use Supabase or another external database, turn on that provider&amp;#x27;s backups.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://docs.replit.com/features/version-control/checkpoints-and-rollbacks&quot;&gt;Replit: Checkpoints and Rollbacks&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.replit.com/features/data-and-storage/data-recovery&quot;&gt;Replit: Data recovery (checkpoints, point-in-time recovery, scheduled backups)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.replit.com/features/data-and-storage/development-and-production&quot;&gt;Replit: Development and production databases&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.replit.com/features/data-and-storage/publish-database-changes&quot;&gt;Replit: How Publish updates your production database&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.replit.com/features/data-and-storage/work-with-your-data&quot;&gt;Replit: Work with your data (export your production database)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/replit-rollback-does-not-restore-database.html&quot;&gt;Replit rollback did not bring my data back: how to restore the development or production database&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>AI &quot;fixed&quot; my Supabase error by disabling RLS or using the service_role key: how to undo it safely</title><link>https://unbreakmyapp.vercel.app/fixes/ai-fix-disabled-rls-or-swapped-service-role.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/ai-fix-disabled-rls-or-swapped-service-role.html</guid><pubDate>Tue, 10 Nov 2026 06:00:00 +0000</pubDate><category>Database / Supabase RLS</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><category>Replit</category><category>v0</category><description>When a Supabase query fails with &#x27;permission denied&#x27;, &#x27;new row violates row-level security policy&#x27;, PGRST116 or an empty result, the fastest way for an AI coding agent to make the error disappear is to remove the check instead of fixing it. The three common shortcuts are: running alter table ...</description><content:encoded>&lt;p&gt;When a Supabase query fails with &amp;#x27;permission denied&amp;#x27;, &amp;#x27;new row violates row-level security policy&amp;#x27;, PGRST116 or an empty result, the fastest way for an AI coding agent to make the error disappear is to remove the check instead of fixing it. The three common shortcuts are: running alter table ...&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Security Advisor flags 0013 rls_disabled_in_public or 0007 policy_exists_rls_disabled right after an AI fix / the diff contains &amp;#x27;disable row level security&amp;#x27;, &amp;#x27;using (true)&amp;#x27; or a new NEXT_PUBLIC_ or VITE_ variable holding the service_role or sb_secret_ key / the error went away but now every user can see every row&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;When a Supabase query fails with &amp;#x27;permission denied&amp;#x27;, &amp;#x27;new row violates row-level security policy&amp;#x27;, PGRST116 or an empty result, the fastest way for an AI coding agent to make the error disappear is to remove the check instead of fixing it. The three common shortcuts are: running alter table ... disable row level security; replacing a real policy with one that uses (true) for every role; or creating the client with the service_role key (or a new sb_secret_ secret key) so the query skips RLS entirely. Each one makes the app &amp;#x27;work&amp;#x27; in testing, which is why it slips through. The cost is that your publishable or anon key, which ships in every browser and app bundle by design, now reaches every row in that table. Supabase&amp;#x27;s own docs say the publishable key is only safe because Row Level Security limits what it can reach, and that the service_role role has BYPASSRLS, so policies never apply to it. Legacy service_role keys are long JWTs starting with eyJ that work anywhere, including a browser; the newer sb_secret_ keys are rejected with HTTP 401 when sent from a browser, so an agent that hits that 401 may &amp;#x27;fix&amp;#x27; it by moving to the legacy key or by proxying it through a public endpoint with no auth check. The original error still needs a real fix: usually a missing SELECT or INSERT policy, a query running before the session loads, or a missing table GRANT.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Find what the agent changed. Search the git history and your migrations for &amp;#x27;disable row level security&amp;#x27;, &amp;#x27;using (true)&amp;#x27;, &amp;#x27;with check (true)&amp;#x27;, &amp;#x27;service_role&amp;#x27;, &amp;#x27;sb_secret_&amp;#x27;, &amp;#x27;SERVICE_ROLE&amp;#x27; and &amp;#x27;bypassrls&amp;#x27; (for example git log -p -S &amp;#x27;service_role&amp;#x27;). In Lovable, Bolt or Replit, check the chat history or version history for the step where the error &amp;#x27;went away&amp;#x27;.&lt;/li&gt;&lt;li&gt;List tables with RLS off: select tablename, rowsecurity from pg_tables where schemaname = &amp;#x27;public&amp;#x27;; Any row with rowsecurity = false is reachable by anyone with your publishable or anon key. Also open Advisors &amp;gt; Security Advisor in the Dashboard and look for 0013 rls_disabled_in_public, 0007 policy_exists_rls_disabled (policies exist but RLS was switched off, the typical sign of an AI shortcut) and 0024 permissive_rls_policy.&lt;/li&gt;&lt;li&gt;Turn RLS back on for each affected table: alter table public.&amp;lt;table&amp;gt; enable row level security; Existing policies take effect again straight away. If the table has no policies, all access through the publishable key is blocked until you add them, so do the next step before you redeploy.&lt;/li&gt;&lt;li&gt;Replace any using (true) or with check (true) policy with an owner check scoped to the right role, for example: create policy &amp;quot;owner can read&amp;quot; on public.&amp;lt;table&amp;gt; for select to authenticated using ((select auth.uid()) = user_id); Add matching INSERT (with check), UPDATE (using and with check) and DELETE policies only for the operations the app really needs. Keep anon read-only, and only on data that is meant to be public.&lt;/li&gt;&lt;li&gt;Move every secret key out of client code. Search the built bundle and your env files for keys starting with eyJ that decode to role service_role, or for sb_secret_. Any variable with a NEXT_PUBLIC_, VITE_ or EXPO_PUBLIC_ prefix is shipped to the browser. The client must use the publishable (or legacy anon) key; the secret key belongs only in server routes, Edge Functions or jobs that check who the caller is before acting.&lt;/li&gt;&lt;li&gt;If a secret or service_role key was ever deployed to the browser or committed, treat it as leaked: create a new secret key, switch your backend to it, then revoke the old key (or disable the legacy JWT keys) under Settings &amp;gt; API Keys. Do this after the code no longer needs the old key, so production does not break.&lt;/li&gt;&lt;li&gt;Check the Postgres roles were not changed: select rolname, rolbypassrls from pg_roles where rolname in (&amp;#x27;anon&amp;#x27;,&amp;#x27;authenticated&amp;#x27;); Both should be false. Supabase warns against changing these roles&amp;#x27; attributes.&lt;/li&gt;&lt;li&gt;Now fix the original error properly. &amp;#x27;permission denied for table&amp;#x27; is a missing GRANT, an empty result or PGRST116 is a missing SELECT policy or a query that runs before the user is signed in, and &amp;#x27;new row violates row-level security policy&amp;#x27; is an INSERT or UPDATE policy whose with check fails. See the related fixes below.&lt;/li&gt;&lt;li&gt;Assess exposure. If the table was open while the app was live, check API logs (Logs &amp;gt; API in the Dashboard) for unexpected reads or writes from the anon role, and decide whether users need to be told under your privacy obligations.&lt;/li&gt;&lt;li&gt;Stop it happening again: add a line to your tool&amp;#x27;s project rules or knowledge file such as &amp;#x27;Never disable RLS, never use using (true), never put the service_role or secret key in client code; fix the policy instead&amp;#x27;, and re-run the Security Advisor after every AI fix that touches the database.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/api/api-keys&quot;&gt;Supabase: Understanding API keys&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/postgres/row-level-security&quot;&gt;Supabase: Row Level Security&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/api/securing-your-api&quot;&gt;Supabase: Securing your API&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/database-advisors&quot;&gt;Supabase: Database Advisors&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/database-linter?lint=0007_policy_exists_rls_disabled&quot;&gt;Supabase lint 0007: policy_exists_rls_disabled&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/database-linter?lint=0013_rls_disabled_in_public&quot;&gt;Supabase lint 0013: rls_disabled_in_public&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/postgres/roles&quot;&gt;Supabase: Postgres roles&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/ai-fix-disabled-rls-or-swapped-service-role.html&quot;&gt;AI &amp;quot;fixed&amp;quot; my Supabase error by disabling RLS or using the service_role key: how to undo it safely&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Better Auth security release (Nov 2026): upgrade to 1.7.16 to stop Expo account takeover</title><link>https://unbreakmyapp.vercel.app/fixes/better-auth-expo-account-takeover-below-1-7-16.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/better-auth-expo-account-takeover-below-1-7-16.html</guid><pubDate>Mon, 09 Nov 2026 06:00:00 +0000</pubDate><category>Auth</category><category>Cursor</category><category>v0</category><category>Bolt</category><category>Replit</category><description>Better Auth is a popular TypeScript auth library that AI coding tools often add to Next.js and Expo (React Native) apps. On 3 November 2026 the Better Auth team shipped a coordinated security release, 1.7.16 (and 1.8.0-beta.5 on the beta line), fixing 12 advisories.</description><content:encoded>&lt;p&gt;Better Auth is a popular TypeScript auth library that AI coding tools often add to Next.js and Expo (React Native) apps. On 3 November 2026 the Better Auth team shipped a coordinated security release, 1.7.16 (and 1.8.0-beta.5 on the beta line), fixing 12 advisories.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;GHSA-4wq4-2ppv-q3hg / CVE-2026-121802 (critical, CVSS 9.1): @better-auth/expo below 1.7.16 lets an attacker who knows a user&amp;#x27;s email change that account&amp;#x27;s email and sign in as them / npm audit or Dependabot flags better-auth or @better-auth/* below 1.7.16&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;Better Auth is a popular TypeScript auth library that AI coding tools often add to Next.js and Expo (React Native) apps. On 3 November 2026 the Better Auth team shipped a coordinated security release, 1.7.16 (and 1.8.0-beta.5 on the beta line), fixing 12 advisories. The critical one is in the expo() server plugin from @better-auth/expo, versions 1.4.0-beta.6 up to 1.7.15. That plugin adds a public endpoint, /expo-authorization-proxy, that helps the phone&amp;#x27;s browser start a social sign-in. It took the OAuth state value from the caller&amp;#x27;s URL and signed it with your application secret without checking that the server had issued it. Better Auth uses the same secret to sign email verification and email-change tokens and, when enabled, the compact session cookie cache, so an attacker could get the server to sign a forged token. Per the advisory, an unauthenticated attacker who knows a user&amp;#x27;s email can sign in as that user and change the account&amp;#x27;s email, with no action from the user; with the session cookie cache on, knowing a user&amp;#x27;s ID is enough to act as them. The same endpoint was also an open redirect, and wildcard trustedOrigins entries (like myapp://* or https://*.example.com) could match URLs you did not mean to trust. You are affected if your server registers expo(); no other setting is needed. The other advisories in the release (phone number claiming, Electron sign-in leaking the secret, revoked sessions staying valid, Stripe billing targeting another customer, organization role padding and more) affect other plugins, so upgrading every Better Auth package matters even if you do not use Expo.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Find out what you run. Check package.json and your lockfile for better-auth and every @better-auth/* package (expo, stripe, electron, passkey, kysely-adapter and so on), or run npm ls better-auth @better-auth/expo. Then search your server auth config (often lib/auth.ts or auth.ts) for expo( in the plugins list. If expo() is registered and the version is 1.4.0-beta.6 to 1.7.15 (or 1.8.0-beta.0 to beta.4), you have the critical bug.&lt;/li&gt;&lt;li&gt;Upgrade every Better Auth package together to the same patched version: 1.7.16 on the stable line, or 1.8.0-beta.5 on the beta line. For example npm install better-auth@1.7.16 @better-auth/expo@1.7.16 (add every other @better-auth/* package you use). The separate packages ship with the same version numbers as better-auth, so mismatched versions are a red flag. Update the Expo app&amp;#x27;s client package too so client and server match.&lt;/li&gt;&lt;li&gt;Redeploy the server. The fix only protects you once the new version is actually running in production, so check the deployment build log or your server&amp;#x27;s package versions after the deploy, not just your local lockfile.&lt;/li&gt;&lt;li&gt;Rotate the application secret if the vulnerable endpoint was reachable. This is the BETTER_AUTH_SECRET environment variable (or the secret option in betterAuth()). Signatures issued before the fix stay valid until the secret changes, so upgrading alone does not cancel tokens an attacker may already hold. Generate a new long random value, set it in your host&amp;#x27;s environment variables for production, and redeploy. Expect existing sessions and pending verification or email-change links signed with the old secret to stop working, so users may need to sign in again.&lt;/li&gt;&lt;li&gt;If Expo sign-in through an SSO identity provider breaks after upgrading, add that identity provider&amp;#x27;s origin to trustedOrigins. Review any wildcard trustedOrigins entries and replace them with exact origins where you can; patched versions match wildcards by parsed scheme, host and path, so a URL that used to slip through may now be rejected.&lt;/li&gt;&lt;li&gt;Check for signs of abuse. Look in your user table for unexpected email changes since you deployed the affected version (compare updated emails against support tickets or old backups), look at your auth logs for requests to /expo-authorization-proxy with unusual state values or external redirect targets, and reach out to any user whose email changed without them asking.&lt;/li&gt;&lt;li&gt;Read the advisory for each other plugin you use, because some need a cleanup step after upgrading: the Stripe plugin advisory says to find Stripe customer IDs linked to more than one user and check them against the customer&amp;#x27;s metadata.userId; the phone number plugin advisory says to remove phone numbers whose verification never completed; the Electron plugin advisory says to treat the auth secret and social provider client secrets as exposed and rotate all of them.&lt;/li&gt;&lt;li&gt;If you cannot upgrade right now and you do not use Expo social sign-in, remove the expo() plugin from the server config and redeploy. If you do need it, the advisory&amp;#x27;s stopgap is to block requests to /expo-authorization-proxy (under your auth base path) whose authorizationURL carries a state value that is not exactly 32 characters of A-Z, a-z, 0-9, - and _. That blocks the signing problem only, so still upgrade.&lt;/li&gt;&lt;li&gt;Do not rely on a firewall alone. Vercel says it deployed free WAF rules that block the exploitable request patterns for projects hosted on Vercel, but its bulletin also says a WAF cannot invalidate signatures forged before the rules went live and that upgrading (plus secret rotation for expo() users) is required.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://github.com/better-auth/better-auth/security/advisories/GHSA-4wq4-2ppv-q3hg&quot;&gt;Better Auth advisory GHSA-4wq4-2ppv-q3hg (@better-auth/expo)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://github.com/advisories/GHSA-hv45-wgqh-c9j5&quot;&gt;GitHub Advisory Database: GHSA-hv45-wgqh-c9j5 (CVE-2026-121802)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://github.com/better-auth/better-auth/releases/tag/v1.7.16&quot;&gt;Better Auth release v1.7.16&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://vercel.com/kb/bulletin/better-auth-november-2026-security-release&quot;&gt;Vercel: Better Auth November 2026 security release&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.better-auth.com/docs/integrations/expo&quot;&gt;Better Auth: Expo integration&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.better-auth.com/docs/reference/options&quot;&gt;Better Auth: Options reference (secret, trustedOrigins)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/better-auth-expo-account-takeover-below-1-7-16.html&quot;&gt;Better Auth security release (Nov 2026): upgrade to 1.7.16 to stop Expo account takeover&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Supabase .single() error PGRST116: JSON object requested, multiple (or no) rows returned</title><link>https://unbreakmyapp.vercel.app/fixes/supabase-single-json-object-requested-no-rows-pgrst116.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/supabase-single-json-object-requested-no-rows-pgrst116.html</guid><pubDate>Sun, 08 Nov 2026 06:00:00 +0000</pubDate><category>Database / Supabase RLS</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><category>Replit</category><category>v0</category><description>When your code calls .single(), supabase-js asks PostgREST (the API layer in front of your Supabase database) for one JSON object instead of an array. PostgREST only returns that if the query matched exactly one row; with 0 rows or 2+ rows it responds with HTTP 406 and error code PGRST116.</description><content:encoded>&lt;p&gt;When your code calls .single(), supabase-js asks PostgREST (the API layer in front of your Supabase database) for one JSON object instead of an array. PostgREST only returns that if the query matched exactly one row; with 0 rows or 2+ rows it responds with HTTP 406 and error code PGRST116.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;PGRST116 (HTTP 406): &amp;#x27;JSON object requested, multiple (or no) rows returned&amp;#x27; / newer wording &amp;#x27;Cannot coerce the result to a single JSON object&amp;#x27; with details &amp;#x27;The result contains 0 rows&amp;#x27; (or 2+ rows) / page crashes or shows blank after .single()&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;When your code calls .single(), supabase-js asks PostgREST (the API layer in front of your Supabase database) for one JSON object instead of an array. PostgREST only returns that if the query matched exactly one row; with 0 rows or 2+ rows it responds with HTTP 406 and error code PGRST116. Without .single() the same query would just return [] or a list with no error. In vibe-coded apps the 0-row case is by far the most common, and the row usually does exist: Row Level Security hides rows the current user is not allowed to see, so they are silently removed before the count. Typical triggers are a query that runs before the auth session has loaded (auth.uid() is null, so a policy like auth.uid() = user_id matches nothing), a server-side or Edge Function client that does not forward the user&amp;#x27;s JWT, a missing SELECT policy, a profile row that was never created by the signup trigger, or filtering on the wrong column (id vs user_id). The 2+ rows case happens when the column you filter on is not unique, for example duplicate profiles rows created by a retry or a double-click. Writes are a special case: update().eq().select().single() or delete().select().single() return PGRST116 when RLS (USING or the SELECT policy) filters the target row out, because 0 rows were changed. insert().select().single() is different: if the new row is not visible to the SELECT policy, Postgres throws 42501 &amp;#x27;new row violates row-level security policy&amp;#x27; instead, because rows returned by RETURNING are never silently dropped.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Read the error details, not just the message. &amp;#x27;The result contains 0 rows&amp;#x27; (or &amp;#x27;Results contain 0 rows&amp;#x27;) means nothing matched; &amp;#x27;2 rows&amp;#x27; or more means your filter is not unique. The code is always PGRST116 with HTTP 406, whichever wording your PostgREST version uses.&lt;/li&gt;&lt;li&gt;Decide whether zero rows is a valid answer. For lookups that may legitimately find nothing (a profile not created yet, an optional setting, &amp;#x27;does this slug exist?&amp;#x27;), replace .single() with .maybeSingle(). It returns data: null and error: null for 0 rows, so handle null explicitly (show a 404, an empty state, or create the row). Keep .single() only where exactly one row must exist.&lt;/li&gt;&lt;li&gt;If the row exists in the Table Editor but the app gets 0 rows, check RLS. The Dashboard SQL editor runs as postgres and bypasses policies, so test as the user instead: confirm RLS is on, that there is a SELECT policy for the authenticated role (for example using ((select auth.uid()) = user_id)), and that the user_id stored on the row really matches the signed-in user&amp;#x27;s id (same type, uuid vs text).&lt;/li&gt;&lt;li&gt;Make sure the request is actually signed in. Wait for the session before querying (use supabase.auth.getSession() / onAuthStateChange on the client, or the @supabase/ssr server client that reads auth cookies in Next.js). In Edge Functions or API routes create the client with the caller&amp;#x27;s Authorization header. If the request is anonymous, auth.uid() is null and owner policies match nothing.&lt;/li&gt;&lt;li&gt;Check the filter itself: right table, right column (profiles.id vs profiles.user_id), right value (not undefined, not a stale id from the URL). Log the exact value you pass to .eq() and run the same select in the SQL editor.&lt;/li&gt;&lt;li&gt;If you see 2+ rows, fix the data and the schema, not just the query. Find duplicates (group by the column having count(*) &amp;gt; 1), delete or merge the extras, then add a unique constraint or unique index on that column (for profiles, make id the primary key referencing auth.users). Only use .limit(1).single() with an explicit .order() when &amp;#x27;pick the newest&amp;#x27; is genuinely what you want.&lt;/li&gt;&lt;li&gt;For update/delete with .select().single(): a PGRST116 here means 0 rows were updated or deleted, usually because the UPDATE/DELETE policy USING clause or the missing SELECT policy filtered the row out. Postgres needs a SELECT policy too for UPDATE to see the row. Add or fix those policies (see the related &amp;#x27;update saved but gone after refresh&amp;#x27; fix), or use .maybeSingle() and treat null as &amp;#x27;not allowed or not found&amp;#x27;.&lt;/li&gt;&lt;li&gt;For insert().select().single(): this does not give PGRST116 for RLS. If the row is blocked by the INSERT policy or not visible to the SELECT policy you get 42501 &amp;#x27;new row violates row-level security policy&amp;#x27;. Fix the INSERT WITH CHECK and add a SELECT policy that lets the owner read the new row, or drop .select() if you do not need the row back. Upsert with ignoreDuplicates: true can return 0 rows when the row already existed, so use .maybeSingle() there.&lt;/li&gt;&lt;li&gt;Never &amp;#x27;fix&amp;#x27; PGRST116 by switching to the service_role key in the browser or disabling RLS. That hides the symptom and exposes every row. Fix the policy, the session, or the query.&lt;/li&gt;&lt;li&gt;Retest as a brand-new user, an existing user, and a signed-out visitor. Each should get either the one row, a handled null, or a clean &amp;#x27;not found&amp;#x27; state, with no 406 in the browser Network tab.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://docs.postgrest.org/en/stable/references/errors.html&quot;&gt;PostgREST: Error codes (PGRST116, HTTP 406)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.postgrest.org/en/stable/references/api/resource_representation.html&quot;&gt;PostgREST: Singular or plural responses&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/reference/javascript/single&quot;&gt;Supabase JS: single()&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/reference/javascript/maybesingle&quot;&gt;Supabase JS: maybeSingle()&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/reference/javascript/insert&quot;&gt;Supabase JS: insert() (rows not returned unless .select())&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/postgres/row-level-security&quot;&gt;Supabase: Row Level Security&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.postgresql.org/docs/current/sql-createpolicy.html&quot;&gt;PostgreSQL: CREATE POLICY (RETURNING and SELECT policies)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/supabase-single-json-object-requested-no-rows-pgrst116.html&quot;&gt;Supabase .single() error PGRST116: JSON object requested, multiple (or no) rows returned&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Stripe email: Your webhook endpoint is failing and will be disabled. How to fix and re-enable it</title><link>https://unbreakmyapp.vercel.app/fixes/stripe-webhook-failing-email-endpoint-will-be-disabled.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/stripe-webhook-failing-email-endpoint-will-be-disabled.html</guid><pubDate>Thu, 05 Nov 2026 06:00:00 +0000</pubDate><category>Payments</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><category>Replit</category><category>v0</category><description>Stripe delivers each webhook event to your HTTPS URL and expects a fast 2xx response. In live mode it retries failed deliveries for up to about 3 days with exponential backoff, emails you that the endpoint is failing, and if failures keep coming it disables the endpoint so Stripe stops calling it.</description><content:encoded>&lt;p&gt;Stripe delivers each webhook event to your HTTPS URL and expects a fast 2xx response. In live mode it retries failed deliveries for up to about 3 days with exponential backoff, emails you that the endpoint is failing, and if failures keep coming it disables the endpoint so Stripe stops calling it.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Email from Stripe: &amp;#x27;Your webhook endpoint is failing&amp;#x27; / &amp;#x27;Fix it or we will disable it by &amp;lt;date&amp;gt;&amp;#x27; / Dashboard shows the endpoint Disabled, Event deliveries Failed with 4xx, 5xx, timeout, Unable to connect, or 3xx redirect / paid customers stop getting upgraded&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;Stripe delivers each webhook event to your HTTPS URL and expects a fast 2xx response. In live mode it retries failed deliveries for up to about 3 days with exponential backoff, emails you that the endpoint is failing, and if failures keep coming it disables the endpoint so Stripe stops calling it. Vibe-coded apps hit this often: the URL 404s after a redeploy (route renamed, preview URL left in the Dashboard, Hobby project deleted), signature verification fails and the handler returns 400 (wrong whsec_ secret, test secret in live, or the body was parsed as JSON before constructEvent), the handler times out because it does slow work (DB writes, emails, AI calls) before returning 200, a Supabase Edge Function still has JWT verification on so Stripe&amp;#x27;s unsigned POST gets 401, auth or CSRF middleware blocks POST /webhook, the URL redirects (3xx counts as a failure), TLS is broken, or a cold start on a free host takes too long. Once the endpoint is disabled, new events are not delivered and paying users stop unlocking until you fix the root cause, re-enable the endpoint, and backfill missed events.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Open the Stripe email and note the endpoint URL and the disable date. In Stripe Dashboard (or Workbench) go to Developers → Webhooks (or the Webhooks tab), open that endpoint, and read Event deliveries. Note the HTTP status for recent Failed/Pending attempts: 404, 401/403, 400, 500, Timed out, Unable to connect, TLS error, or 3xx.&lt;/li&gt;&lt;li&gt;If the endpoint already shows Disabled, plan to re-enable it only after the URL returns 2xx. Re-enabling alone does not replay events Stripe already gave up on.&lt;/li&gt;&lt;li&gt;404 or Unable to connect: confirm the production URL still exists. Redeploy so the webhook route is live, update the endpoint URL in the Dashboard to the exact production path (no trailing slash mismatch, no leftover preview URL, https only), and make sure the host accepts POST.&lt;/li&gt;&lt;li&gt;401, 403 or 405: exclude the webhook path from auth, JWT and CSRF middleware. If the handler is a Supabase Edge Function, set verify_jwt = false for that function (or deploy with --no-verify-jwt) and verify the Stripe-Signature inside the function instead.&lt;/li&gt;&lt;li&gt;400 with signature errors: use the raw request body (req.text() / express.raw), the whsec_ secret for this exact endpoint and mode (CLI secret is different from the Dashboard secret; test differs from live), and return 400 only when verification fails. See the related signature-failed fix.&lt;/li&gt;&lt;li&gt;500 or Timed out: wrap the handler so it verifies the signature, records the event id, returns 200 immediately, then does slow work (fulfilment, email, AI) afterwards or in a queue. Stripe treats timeouts and 5xx as failures and will keep retrying.&lt;/li&gt;&lt;li&gt;3xx redirects: Stripe counts redirects as failures. Point the endpoint at the final URL with no redirect.&lt;/li&gt;&lt;li&gt;Fix the code, deploy, then test: from the endpoint&amp;#x27;s Event deliveries use Resend on a recent event, or run stripe trigger checkout.session.completed (and stripe listen --forward-to localhost:... while developing). Confirm a Delivered attempt with status 200.&lt;/li&gt;&lt;li&gt;Re-enable the endpoint in the Dashboard (or set status to enabled via the Webhook Endpoints API). Watch new deliveries go green.&lt;/li&gt;&lt;li&gt;Backfill what you missed: list events with delivery_success=false for the event types you care about (Stripe keeps them for 30 days), process each event id idempotently (same as your live handler), and return 200 if Stripe&amp;#x27;s automatic retries deliver one you already handled. Check recent Checkout Sessions or subscriptions against your database for users who paid but were never upgraded.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://docs.stripe.com/webhooks&quot;&gt;Stripe: Receive webhook events&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.stripe.com/events/manage-webhook-endpoints&quot;&gt;Stripe: Manage webhook endpoints&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.stripe.com/api/webhook_endpoints/update&quot;&gt;Stripe: Update a webhook endpoint&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.stripe.com/billing/subscriptions/webhooks&quot;&gt;Stripe: Webhooks and subscriptions (retries and failing-endpoint email)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.stripe.com/cli/listen&quot;&gt;Stripe CLI: listen&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/stripe-webhook-failing-email-endpoint-will-be-disabled.html&quot;&gt;Stripe email: Your webhook endpoint is failing and will be disabled. How to fix and re-enable it&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Supabase project paused: app suddenly can&#x27;t connect (Failed to fetch, 540) and how to bring it back</title><link>https://unbreakmyapp.vercel.app/fixes/supabase-project-paused-app-cant-connect.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/supabase-project-paused-app-cant-connect.html</guid><pubDate>Thu, 05 Nov 2026 06:00:00 +0000</pubDate><category>Database / Supabase RLS</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><category>Replit</category><category>v0</category><description>Supabase pauses projects on the Free plan when they get too little database activity over a 7-day period. Side projects, demos and apps you built and then stopped testing are the usual victims: no visitors means no queries, so after about a week the project is paused.</description><content:encoded>&lt;p&gt;Supabase pauses projects on the Free plan when they get too little database activity over a 7-day period. Side projects, demos and apps you built and then stopped testing are the usual victims: no visitors means no queries, so after about a week the project is paused.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Your Lovable, Bolt or Cursor app worked last week and now nothing loads: login spins forever, lists are empty, the console says &amp;#x27;TypeError: Failed to fetch&amp;#x27; (or &amp;#x27;fetch failed&amp;#x27;, ENOTFOUND or ECONNREFUSED from server code), the Network tab shows status 540 from your *.supabase.co URL, and you have an email from Supabase saying your project was paused&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;Supabase pauses projects on the Free plan when they get too little database activity over a 7-day period. Side projects, demos and apps you built and then stopped testing are the usual victims: no visitors means no queries, so after about a week the project is paused. Supabase emails the project owner a warning roughly a week before and a confirmation when it happens, but those emails often go to an inbox you don&amp;#x27;t check or to the account your AI builder used to create the project. While a project is paused it cannot process any request, and the platform answers with the custom status code 540 (project paused), so the browser just reports a failed fetch and the app looks broken. Nothing in your code changed, so asking the AI builder to fix it only makes it rewrite working code. Your data and settings are kept: a paused project can be resumed from the dashboard for up to 1 year after it was paused (Supabase used to allow 90 days; the current docs say 1 year). After that window the Resume option is gone and you have to download the backup and Storage files and move them to a new project. Paid plans (Pro and above) are never paused for inactivity.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Confirm it is a pause, not a code bug. Open the browser dev tools, go to Network, reload, and click a failing request to your https://&amp;lt;ref&amp;gt;.supabase.co URL. Status 540 means the project is paused. Also search your email (including spam) for a message from Supabase about pausing, and check status.supabase.com for a wider outage.&lt;/li&gt;&lt;li&gt;Stop prompting the AI builder. Do not let it change the Supabase URL, keys or queries while the project is paused; the code is fine and every rewrite is a new bug to undo later.&lt;/li&gt;&lt;li&gt;Resume the project: Supabase Dashboard → select the organization → select the paused project → Resume project, then confirm. Wait until the project shows as healthy (usually a few minutes), then reload your app.&lt;/li&gt;&lt;li&gt;If Resume is blocked because you already have 2 active Free projects, pause one you don&amp;#x27;t need first (paused projects don&amp;#x27;t count toward the 2-project limit), or move this project to a paid organization.&lt;/li&gt;&lt;li&gt;Make sure the app points at the project you just resumed: compare the project URL and anon or publishable key in your app&amp;#x27;s environment variables (Lovable, Bolt, Vercel, Netlify or .env) with Settings → API in the dashboard. Builders sometimes create a second project, so you may have resumed the wrong one.&lt;/li&gt;&lt;li&gt;Test the basics once: sign in, load one list, save one row. If you now get &amp;#x27;relation does not exist&amp;#x27;, &amp;#x27;permission denied&amp;#x27; or an RLS error, that is a different problem with its own fix, not the pause.&lt;/li&gt;&lt;li&gt;If the app uses Lovable Cloud (the backend Lovable manages for you) rather than your own Supabase account, you won&amp;#x27;t find it in your Supabase dashboard. Check Lovable&amp;#x27;s status page and contact Lovable support instead of creating a new Supabase project.&lt;/li&gt;&lt;li&gt;If the project was paused more than 1 year ago and there is no Resume button: in the paused project&amp;#x27;s dashboard, download the database backup and every Storage bucket&amp;#x27;s files, create a new project, restore the backup with psql using the Session pooler connection string, copy the Storage files back (supabase storage cp), then update the URL and keys in your app and redeploy. Re-add Edge Function secrets, auth redirect URLs, SMTP and OAuth settings by hand.&lt;/li&gt;&lt;li&gt;Stop it happening again. If real people use the app, upgrade the organization to a paid plan, since paid projects are never paused for inactivity. For a free demo, open the project in the dashboard when you get the warning email, or run a small scheduled job (for example a free GitHub Actions cron) that makes a real read query a few times a day. Supabase says a few requests a day is typically enough, but not guaranteed.&lt;/li&gt;&lt;li&gt;Make sure the pause emails reach you: check which email owns the Supabase organization (Organization settings → Team) and add yourself as Owner if your AI builder created it under another account.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/platform/free-project-pausing&quot;&gt;Supabase: Project pausing&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/troubleshooting/http-status-codes&quot;&gt;Supabase: HTTP status codes (540 project paused)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/platform/billing-faq&quot;&gt;Supabase: Billing FAQ (free project limit)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/troubleshooting/restore-project-after-90-days-pause&quot;&gt;Supabase: Restore a project paused for more than 1 year&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/supabase-project-paused-app-cant-connect.html&quot;&gt;Supabase project paused: app suddenly can&amp;#x27;t connect (Failed to fetch, 540) and how to bring it back&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Supabase: Edge Function returned a non-2xx status code (how to find the real error and fix it)</title><link>https://unbreakmyapp.vercel.app/fixes/supabase-edge-function-non-2xx-status-code.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/supabase-edge-function-non-2xx-status-code.html</guid><pubDate>Wed, 04 Nov 2026 06:00:00 +0000</pubDate><category>Database / Supabase RLS</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><category>Replit</category><category>v0</category><description>This message is a wrapper, not the real error. supabase.functions.invoke() reached your Edge Function (or the Supabase gateway in front of it), but the response had a status outside 200 to 299, so supabase-js returns a FunctionsHttpError with this generic text and puts the actual Response on error.context.</description><content:encoded>&lt;p&gt;This message is a wrapper, not the real error. supabase.functions.invoke() reached your Edge Function (or the Supabase gateway in front of it), but the response had a status outside 200 to 299, so supabase-js returns a FunctionsHttpError with this generic text and puts the actual Response on error.context.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;FunctionsHttpError: Edge Function returned a non-2xx status code. A button that calls supabase.functions.invoke() (AI chat, send email, checkout, generate image) fails with this message and nothing else, data is null, and the AI builder keeps rewriting the function without fixing it&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;This message is a wrapper, not the real error. supabase.functions.invoke() reached your Edge Function (or the Supabase gateway in front of it), but the response had a status outside 200 to 299, so supabase-js returns a FunctionsHttpError with this generic text and puts the actual Response on error.context. Most apps never read it, so the status code and the function&amp;#x27;s own error message stay hidden, and the AI builder guesses. The status code tells you which problem you have: 401 means the platform&amp;#x27;s JWT check rejected the call before your code ran (no signed-in user, an expired session, or a webhook or cron job that sends no user token); 404 means the function isn&amp;#x27;t deployed or the name is wrong; 500 means your code threw, most often because a secret such as OPENAI_API_KEY or STRIPE_SECRET_KEY is missing so Deno.env.get() returned undefined, because req.json() failed on an empty or non-JSON body, or because a database call or third-party API (OpenAI, Stripe, Resend) failed and the error wasn&amp;#x27;t caught; 503 means the function failed to boot (syntax or import error); 504 means it ran past the time limit; 546 means it hit a memory or CPU limit. Your function can also return 400, 403 or 429 on purpose, or pass along an error status from an API it called. If the browser shows a CORS or &amp;#x27;Failed to send a request&amp;#x27; error instead, that is a different error, FunctionsFetchError, with its own fix.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Read the real status and body in the app. Change the call to: const { data, error } = await supabase.functions.invoke(&amp;#x27;&amp;lt;NAME&amp;gt;&amp;#x27;, { body }); then if (error instanceof FunctionsHttpError) { const res = error.context; console.log(res.status, await res.text()); } (import FunctionsHttpError from @supabase/supabase-js). Use text() rather than json() so a plain-text error body still prints, and read the body only once.&lt;/li&gt;&lt;li&gt;Open the function&amp;#x27;s logs: Supabase Dashboard → Edge Functions → the function → Logs and Invocations. Find the failed call at the same time and read the status code and any uncaught exception or console.error output.&lt;/li&gt;&lt;li&gt;401: the gateway&amp;#x27;s JWT check rejected the request and your code never ran. From the browser, make sure the user is signed in before calling, and let supabase.functions.invoke send the session token for you instead of setting your own Authorization header. For a Stripe webhook, cron job or other service calling the function, turn off JWT verification for that one function (verify_jwt = false under [functions.&amp;lt;NAME&amp;gt;] in supabase/config.toml, or deploy with --no-verify-jwt) and check the caller inside the function instead, for example with the Stripe signature.&lt;/li&gt;&lt;li&gt;404: check that the function is deployed in the same project your app points at (Dashboard → Edge Functions, or supabase functions list) and that the name in invoke() matches the folder name exactly. Builders sometimes create the function file without deploying it.&lt;/li&gt;&lt;li&gt;500 with a missing secret: list every Deno.env.get(&amp;#x27;...&amp;#x27;) the function uses and set each one under Edge Functions → Secrets (or supabase secrets set NAME=value). At the top of the function, return a clear JSON error if a required secret is missing so the next failure explains itself. Secrets in a Vercel or Lovable frontend env panel are not visible to Edge Functions.&lt;/li&gt;&lt;li&gt;500 from the request body: send JSON from the client (invoke(&amp;#x27;&amp;lt;NAME&amp;gt;&amp;#x27;, { body: { ... } }) with a plain object), and in the function wrap await req.json() in try/catch and return a 400 with a message if it fails or a required field is missing.&lt;/li&gt;&lt;li&gt;500 from a third-party API or the database: wrap the whole handler in try/catch, console.error the full error, and return a JSON body such as { error: &amp;#x27;OpenAI request failed&amp;#x27;, status: 429 } with a matching status. Never return the API key, the raw upstream error with headers, or a stack trace to the browser.&lt;/li&gt;&lt;li&gt;503, 504 or 546: 503 is a boot error, so run supabase functions serve locally or redeploy and read the boot error in the logs. 504 is a timeout, so add a timeout to slow API calls and move long jobs (big AI generations, bulk emails) to a background task or queue. 546 is a resource limit, so stop loading huge files or arrays into memory at once.&lt;/li&gt;&lt;li&gt;Keep the CORS headers on every response, including the error responses you just added, and answer OPTIONS requests first, otherwise the browser hides your new error message behind a CORS failure.&lt;/li&gt;&lt;li&gt;Show the user a friendly message based on the status (for example &amp;#x27;Please sign in again&amp;#x27; for 401, &amp;#x27;Try again in a minute&amp;#x27; for 429 or 504) instead of the raw text, and redeploy the function after every change.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/functions/status-codes&quot;&gt;Supabase: Edge Function status codes&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/functions/auth&quot;&gt;Supabase: Securing Edge Functions&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/functions/secrets&quot;&gt;Supabase: Edge Function secrets&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/supabase-edge-function-non-2xx-status-code.html&quot;&gt;Supabase: Edge Function returned a non-2xx status code (how to find the real error and fix it)&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Supabase RLS is on but every user can read every row: fix USING (true) and auth.uid() is not null policies</title><link>https://unbreakmyapp.vercel.app/fixes/supabase-rls-policy-using-true-any-user-can-read.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/supabase-rls-policy-using-true-any-user-can-read.html</guid><pubDate>Tue, 03 Nov 2026 06:00:00 +0000</pubDate><category>Database / Supabase RLS</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><category>Replit</category><category>v0</category><description>Turning RLS on is only half the job: the policies decide who sees what. When an AI builder hits &#x27;new row violates row-level security policy&#x27; or an empty result mid-build, the quickest change that makes the error go away is a policy that allows everything, such as USING (true).</description><content:encoded>&lt;p&gt;Turning RLS on is only half the job: the policies decide who sees what. When an AI builder hits &amp;#x27;new row violates row-level security policy&amp;#x27; or an empty result mid-build, the quickest change that makes the error go away is a policy that allows everything, such as USING (true).&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Row Level Security shows as enabled, but a logged-in user (or a logged-out visitor with the anon key) can still read or edit other people&amp;#x27;s rows. The policies say USING (true), TO authenticated USING (true), USING (auth.uid() IS NOT NULL) or USING (auth.role() = &amp;#x27;authenticated&amp;#x27;), or a scanner reports a table is readable by any account&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;Turning RLS on is only half the job: the policies decide who sees what. When an AI builder hits &amp;#x27;new row violates row-level security policy&amp;#x27; or an empty result mid-build, the quickest change that makes the error go away is a policy that allows everything, such as USING (true). Variants that look safer have the same effect: TO authenticated USING (true), auth.uid() IS NOT NULL and auth.role() = &amp;#x27;authenticated&amp;#x27; only check that someone is signed in, and because anyone can sign up for your app, every stranger with an account can read every row through the Supabase Data API using your public anon key. UPDATE policies with no WITH CHECK, or a WITH CHECK (true), also let a user rewrite rows they don&amp;#x27;t own or change user_id to someone else&amp;#x27;s. Postgres combines permissive policies with OR, so one broad policy left over from debugging cancels out the careful owner-only policy next to it. The fix is to scope every policy to the owner (or to data that is genuinely public), remove the catch-all policies, and test as a second user.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;List every policy in one place: in the Supabase SQL editor run select tablename, policyname, roles, cmd, qual, with_check from pg_policies where schemaname = &amp;#x27;public&amp;#x27; order by tablename; and flag any row where qual or with_check is true, auth.uid() IS NOT NULL, or auth.role() = &amp;#x27;authenticated&amp;#x27;. Also open Advisors → Security Advisor, but don&amp;#x27;t rely on it alone.&lt;/li&gt;&lt;li&gt;Test it the way an attacker would: sign up two test accounts, create data as user A, then log in as user B and query the table with supabase-js, for example supabase.from(&amp;#x27;&amp;lt;TABLE&amp;gt;&amp;#x27;).select(&amp;#x27;*&amp;#x27;). If B sees A&amp;#x27;s rows, the policy is too broad. Repeat logged out with only the anon key, where private tables should return [] or an error.&lt;/li&gt;&lt;li&gt;For private, per-user tables, replace the policies with owner-scoped ones, one per operation, for example create policy &amp;quot;Owners can read&amp;quot; on public.&amp;lt;TABLE&amp;gt; for select to authenticated using ((select auth.uid()) = user_id); and do the same for update (with both USING and WITH CHECK set to (select auth.uid()) = user_id), insert (WITH CHECK) and delete (USING). Wrapping auth.uid() in select is the pattern Supabase recommends for performance.&lt;/li&gt;&lt;li&gt;Drop the catch-all policies in the same migration (drop policy &amp;quot;&amp;lt;NAME&amp;gt;&amp;quot; on public.&amp;lt;TABLE&amp;gt;;). Because permissive policies are ORed together, a leftover USING (true) policy overrides every owner-only policy on that table.&lt;/li&gt;&lt;li&gt;For data shared inside a team or workspace, check membership instead of login, for example using (exists (select 1 from public.members m where m.team_id = &amp;lt;TABLE&amp;gt;.team_id and m.user_id = (select auth.uid()))). For genuinely public data, limit the rows with a condition such as using (published = true) rather than true.&lt;/li&gt;&lt;li&gt;Remember RLS works on rows, not columns. If other users may see a profile but not its email or phone, move private columns to a separate owner-only table or expose a view with only the safe columns, created with (security_invoker = on) so it still obeys RLS.&lt;/li&gt;&lt;li&gt;Make sure user_id is set by the database (default auth.uid()) or checked by WITH CHECK, so a user can&amp;#x27;t insert or update rows claiming to be someone else.&lt;/li&gt;&lt;li&gt;Re-run the two-user test and the logged-out test after deploying. If the table was readable by strangers while live, treat it as a data exposure: check what was in it and follow the security-report steps for telling users.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/postgres/row-level-security&quot;&gt;Supabase: Row Level Security&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/database-linter&quot;&gt;Supabase: Database Advisors (linter)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/supabase-rls-policy-using-true-any-user-can-read.html&quot;&gt;Supabase RLS is on but every user can read every row: fix USING (true) and auth.uid() is not null policies&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Your API keys may have leaked: how to rotate every key without breaking your app</title><link>https://unbreakmyapp.vercel.app/fixes/rotate-api-keys-after-leak-or-breach.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/rotate-api-keys-after-leak-or-breach.html</guid><pubDate>Mon, 02 Nov 2026 06:00:00 +0000</pubDate><category>Env vars &amp; leaked keys</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><category>Replit</category><category>v0</category><description>Deleting a key from your code doesn&#x27;t make it safe. Once a secret has been seen by anyone (a scraper watching GitHub, a browser extension, a breached platform that stored it, or someone who got into your builder account) it keeps working until you revoke it at the provider.</description><content:encoded>&lt;p&gt;Deleting a key from your code doesn&amp;#x27;t make it safe. Once a secret has been seen by anyone (a scraper watching GitHub, a browser extension, a breached platform that stored it, or someone who got into your builder account) it keeps working until you revoke it at the provider.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;A key was exposed (in the frontend bundle, a public repo, an error response, a screenshot), your Lovable/GitHub/hosting account was hacked, a provider you use announced a breach, or you see charges and requests you didn&amp;#x27;t make on OpenAI, Stripe, Supabase or another API&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;Deleting a key from your code doesn&amp;#x27;t make it safe. Once a secret has been seen by anyone (a scraper watching GitHub, a browser extension, a breached platform that stored it, or someone who got into your builder account) it keeps working until you revoke it at the provider. Vibe-coded apps usually have keys spread across several places at once: the builder&amp;#x27;s secrets panel (Lovable Cloud, Bolt or Replit Secrets), Supabase edge function secrets, Vercel or Netlify environment variables, a local .env and sometimes the git history, so people often rotate one copy and miss the others, or revoke the old key before the new one is deployed and take the app down. Hosted environment variables also only change on the next deploy, so a new key saved in a dashboard isn&amp;#x27;t live until you redeploy. The safe order is: list every secret, create the new key, update every place it lives, redeploy, check it works, then revoke the old one, unless the key is being abused right now, in which case revoke first and accept a few minutes of downtime.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Make a list of every secret the app uses: open your builder&amp;#x27;s secrets panel, your hosting env vars (Vercel, Netlify), Supabase edge function secrets and your local .env, and write down each key name and which service it belongs to. Don&amp;#x27;t paste the values anywhere.&lt;/li&gt;&lt;li&gt;Decide the order. If you see abuse right now (unexpected OpenAI usage, Stripe charges or refunds you didn&amp;#x27;t make, rows changed in your database), revoke that key immediately, even if the app breaks for a few minutes. Otherwise create the new key first and revoke the old one last.&lt;/li&gt;&lt;li&gt;Supabase: use Project Settings → API Keys. With the new key system you can create a new secret key and delete the leaked one on its own. On legacy anon/service_role JWT keys, rotating the JWT secret or signing key replaces both keys and signs users out, so plan for that. If a database connection string leaked, also reset the database password in Database settings.&lt;/li&gt;&lt;li&gt;Stripe: in Developers → API keys, use Roll key on the secret key. You can let the old key keep working for a short time while you deploy the new one. Roll the webhook signing secret too if it was exposed, and use restricted keys for anything that doesn&amp;#x27;t need full access.&lt;/li&gt;&lt;li&gt;OpenAI and other AI APIs: create a new key, then revoke the old one on the API keys page, and set a monthly budget or usage limit on the project so a future leak can&amp;#x27;t run up a large bill. Do the same for Resend, Twilio, Google Maps and any other paid API.&lt;/li&gt;&lt;li&gt;Update the new value everywhere on your list, then redeploy. On Vercel, Netlify and similar hosts, changed environment variables only apply to new deployments, and Supabase edge functions read secrets set with supabase secrets set or the dashboard.&lt;/li&gt;&lt;li&gt;Test the app end to end (login, payments in test mode, AI features, emails), then revoke the old keys you left active and confirm in each provider&amp;#x27;s dashboard that the old key now fails.&lt;/li&gt;&lt;li&gt;If an account was hacked, secure it before rotating: change the email and builder passwords, turn on 2FA, sign out other sessions and remove unknown GitHub collaborators, deploy keys and OAuth apps, or the attacker can read your new keys too.&lt;/li&gt;&lt;li&gt;Look back through each provider&amp;#x27;s usage, logs and billing for the period the key was exposed, note anything suspicious, and if user data may have been read, follow the security-report steps for telling users.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/api/api-keys&quot;&gt;Supabase: Understanding API keys&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.stripe.com/keys&quot;&gt;Stripe: API keys&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/rotate-api-keys-after-leak-or-breach.html&quot;&gt;Your API keys may have leaked: how to rotate every key without breaking your app&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Your API error response shows your secret key: stop sending raw backend errors to the browser</title><link>https://unbreakmyapp.vercel.app/fixes/backend-error-leaks-api-key-to-browser.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/backend-error-leaks-api-key-to-browser.html</guid><pubDate>Fri, 30 Oct 2026 06:00:00 +0000</pubDate><category>Env vars &amp; leaked keys</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><category>Replit</category><category>v0</category><description>Your keys can be kept out of the frontend bundle and still leak at runtime. AI builders often write catch blocks like catch (err) { return res.status(500).json({ error: err }) } or send err.message, err.response.data or JSON.stringify(err) straight back to the client so the UI can show &#x27;what went wrong&#x27;.</description><content:encoded>&lt;p&gt;Your keys can be kept out of the frontend bundle and still leak at runtime. AI builders often write catch blocks like catch (err) { return res.status(500).json({ error: err }) } or send err.message, err.response.data or JSON.stringify(err) straight back to the client so the UI can show &amp;#x27;what went wrong&amp;#x27;.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;An error from your API route or edge function shows up in the browser (Network tab, toast or console) containing an Authorization: Bearer sk-... header, a database connection string, process.env values, a full stack trace or the third-party request config, e.g. res.json({ error }) or return new Response(JSON.stringify(err))&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;Your keys can be kept out of the frontend bundle and still leak at runtime. AI builders often write catch blocks like catch (err) { return res.status(500).json({ error: err }) } or send err.message, err.response.data or JSON.stringify(err) straight back to the client so the UI can show &amp;#x27;what went wrong&amp;#x27;. Many error objects carry far more than a message: an Axios error includes the request config with its headers (including your Authorization bearer token), database drivers can include the connection string or SQL, some SDKs echo the request body, and a debug helper may dump process.env. Anyone who triggers an error, for example by sending a bad input, can open DevTools and read it. Development-mode error pages and verbose logging turned on in production make it worse. The fix is to log the details only on the server and send the browser a generic message with a reference ID, then rotate any key that was ever exposed.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Reproduce it safely: open your app, open DevTools → Network, trigger failures (submit empty or very long input, log out mid-action, call the API route with curl and a bad body) and read every error response body. Search them for sk_, sk-, Bearer, key, secret, password, postgres:// and eyJ (JWTs).&lt;/li&gt;&lt;li&gt;Search your server code for catch blocks that return the error object: res.json({ error: err }), res.send(err), JSON.stringify(err), err.response.data, err.config or err.stack sent in a response. Check API routes, server actions, Supabase edge functions and any proxy route that calls OpenAI, Stripe or another paid API.&lt;/li&gt;&lt;li&gt;Replace them with a safe pattern: generate an ID (crypto.randomUUID()), log the full error with that ID on the server only (console.error or your error tracker), and return a fixed message such as { error: &amp;#x27;Something went wrong&amp;#x27;, id } with an appropriate status code.&lt;/li&gt;&lt;li&gt;Where users need a specific message (validation errors, &amp;#x27;email already in use&amp;#x27;), return only messages you wrote yourself, never text copied from a third-party error.&lt;/li&gt;&lt;li&gt;Redact secrets in your logs too: don&amp;#x27;t log whole request configs or headers, and strip Authorization, cookies and API keys before logging, because hosting logs are often visible to everyone on the team or integrations.&lt;/li&gt;&lt;li&gt;Make sure production runs in production mode (NODE_ENV=production, no debug flags, no framework dev error overlay) and remove any /debug, /env or /health route that prints environment variables.&lt;/li&gt;&lt;li&gt;Rotate every key that appeared in an error response, even once: create a new key in the provider dashboard, update it in your hosting environment variables, redeploy, then revoke the old key. Check the provider&amp;#x27;s usage and billing for activity you don&amp;#x27;t recognise.&lt;/li&gt;&lt;li&gt;Re-run the first step after deploying to confirm error responses now contain only the generic message and ID.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://cheatsheetseries.owasp.org/cheatsheets/Error_Handling_Cheat_Sheet.html&quot;&gt;OWASP: Error Handling Cheat Sheet&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://cheatsheetseries.owasp.org/cheatsheets/Logging_Cheat_Sheet.html&quot;&gt;OWASP: Logging Cheat Sheet&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/backend-error-leaks-api-key-to-browser.html&quot;&gt;Your API error response shows your secret key: stop sending raw backend errors to the browser&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Visiting the success page unlocks Pro without paying: grant access from the Stripe webhook, not the redirect</title><link>https://unbreakmyapp.vercel.app/fixes/stripe-success-page-grants-access-without-webhook.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/stripe-success-page-grants-access-without-webhook.html</guid><pubDate>Thu, 29 Oct 2026 06:00:00 +0000</pubDate><category>Payments</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><category>Replit</category><category>v0</category><description>AI builders often generate a checkout flow where Stripe redirects to a success_url and the success page itself (or a fetch it makes) marks the user as paid, for example by calling supabase.from(&#x27;profiles&#x27;).update({ is_pro: true }) from the browser or hitting an unauthenticated /api/upgrade route.</description><content:encoded>&lt;p&gt;AI builders often generate a checkout flow where Stripe redirects to a success_url and the success page itself (or a fetch it makes) marks the user as paid, for example by calling supabase.from(&amp;#x27;profiles&amp;#x27;).update({ is_pro: true }) from the browser or hitting an unauthenticated /api/upgrade route.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Anyone who opens /success or /thank-you?session_id=... gets Pro access, users who close the tab after paying never get upgraded, or your app sets is_pro=true from the browser after Stripe Checkout redirects back&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;AI builders often generate a checkout flow where Stripe redirects to a success_url and the success page itself (or a fetch it makes) marks the user as paid, for example by calling supabase.from(&amp;#x27;profiles&amp;#x27;).update({ is_pro: true }) from the browser or hitting an unauthenticated /api/upgrade route. The redirect is just a URL: it can be opened, bookmarked, shared or replayed without any payment, and the session_id in it is not checked. It also fails the other way: if the customer closes the tab, loses connection or pays with a delayed method like a bank debit, the success page never runs and a paying customer stays on the free plan. Stripe&amp;#x27;s own guidance is to fulfil orders from the checkout.session.completed webhook (and async_payment_succeeded for delayed methods), verified with your webhook signing secret, and to treat the success page only as a friendly message.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Test it in Stripe test mode: log in as a free user in a private window and open your success URL directly (for example /success or /success?session_id=cs_test_fake). If the account becomes Pro, you have this bug.&lt;/li&gt;&lt;li&gt;Remove every place the browser can set paid status: no client-side update of is_pro, plan or credits, and add a Supabase RLS policy (or server check) so users cannot update those columns on their own row.&lt;/li&gt;&lt;li&gt;Create a webhook endpoint on your server or a Supabase edge function, and in the Stripe Dashboard (test mode first) subscribe it to checkout.session.completed, checkout.session.async_payment_succeeded and, for subscriptions, customer.subscription.updated and customer.subscription.deleted.&lt;/li&gt;&lt;li&gt;In the webhook, read the raw request body and verify it with stripe.webhooks.constructEvent and your STRIPE_WEBHOOK_SECRET. Reject anything that fails verification with a 400.&lt;/li&gt;&lt;li&gt;Identify the user from data you set on the server when creating the Checkout Session, such as client_reference_id or metadata.user_id, never from the success URL.&lt;/li&gt;&lt;li&gt;Only grant access when payment_status is &amp;#x27;paid&amp;#x27; (or on async_payment_succeeded), check the price IDs and amount_total match what you sell, then update the user&amp;#x27;s plan with a service-role key on the server. Record the event ID so retries don&amp;#x27;t double-grant.&lt;/li&gt;&lt;li&gt;Make the success page read-only: show &amp;#x27;Payment received, unlocking your account…&amp;#x27; and poll your own database for the plan to change, instead of changing it.&lt;/li&gt;&lt;li&gt;Check existing Pro users against paid Checkout Sessions or active subscriptions in Stripe, and downgrade any account that was upgraded without a payment.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://docs.stripe.com/checkout/fulfillment&quot;&gt;Stripe: Fulfill orders (Checkout)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/stripe-success-page-grants-access-without-webhook.html&quot;&gt;Visiting the success page unlocks Pro without paying: grant access from the Stripe webhook, not the redirect&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Users can change the price at checkout: stop trusting amounts sent from the browser to Stripe</title><link>https://unbreakmyapp.vercel.app/fixes/stripe-checkout-price-from-client-tampering.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/stripe-checkout-price-from-client-tampering.html</guid><pubDate>Wed, 28 Oct 2026 06:00:00 +0000</pubDate><category>Payments</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><category>Replit</category><category>v0</category><description>AI builders often generate a checkout flow where the frontend sends the price, amount, currency or quantity to your API route or Supabase edge function, and the server passes it straight into stripe.checkout.sessions.create or stripe.paymentIntents.create using price_data or amount.</description><content:encoded>&lt;p&gt;AI builders often generate a checkout flow where the frontend sends the price, amount, currency or quantity to your API route or Supabase edge function, and the server passes it straight into stripe.checkout.sessions.create or stripe.paymentIntents.create using price_data or amount.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;A customer paid $1 (or $0.50) for a $79 plan, the Stripe Checkout Session or PaymentIntent shows an amount you never set, or your create-checkout endpoint accepts a request body like {&amp;quot;amount&amp;quot;: 7900} or {&amp;quot;price&amp;quot;: 79}&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;AI builders often generate a checkout flow where the frontend sends the price, amount, currency or quantity to your API route or Supabase edge function, and the server passes it straight into stripe.checkout.sessions.create or stripe.paymentIntents.create using price_data or amount. Anything sent from the browser can be edited in DevTools, replayed with curl, or changed in the request, so a user can pay whatever they like. The same flaw shows up as trusting a client-sent discount, a client-sent plan name mapped to an amount the client also controls, unlimited quantity, or granting access on the success page instead of from a verified webhook. The fix is that the server alone decides what is being sold and for how much, using Prices you created in Stripe or a server-side price table.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Test it yourself in Stripe test mode: open DevTools → Network, click your Buy button, find the request to your checkout endpoint and look at its body. If it contains an amount, price, unit_amount, currency or discount value, it can be tampered with.&lt;/li&gt;&lt;li&gt;Create a Product and a Price in the Stripe Dashboard (test mode first) for every plan or item, and copy the Price IDs (they start with price_).&lt;/li&gt;&lt;li&gt;Change the frontend to send only what the customer chose, such as a plan key (&amp;#x27;pro_monthly&amp;#x27;) or a product ID from your own database, never an amount.&lt;/li&gt;&lt;li&gt;On the server, map that key to a Price ID with an allow-list (for example const PRICES = { pro_monthly: process.env.STRIPE_PRICE_PRO_MONTHLY }) and reject anything not in the list with a 400 error.&lt;/li&gt;&lt;li&gt;Create the Checkout Session with line_items: [{ price: PRICES[plan], quantity: 1 }] instead of price_data or amount. If customers can choose a quantity, clamp it on the server to a sensible range, or use Stripe&amp;#x27;s adjustable_quantity with a maximum.&lt;/li&gt;&lt;li&gt;Handle discounts with Stripe Coupons and Promotion Codes (allow_promotion_codes: true or a server-chosen coupon), never with a percentage or amount sent from the browser.&lt;/li&gt;&lt;li&gt;Grant access or fulfil orders only from the checkout.session.completed webhook after verifying the Stripe signature, and check the amount_total and the line items&amp;#x27; price IDs match what you expect before unlocking anything.&lt;/li&gt;&lt;li&gt;Look back through Payments in the Stripe Dashboard for charges below your real prices, and revoke or follow up on any access that was bought at a tampered price.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://docs.stripe.com/products-prices/how-products-and-prices-work&quot;&gt;Stripe: Products and prices&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.stripe.com/api/checkout/sessions/create&quot;&gt;Stripe: Create a Checkout Session&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/stripe-checkout-price-from-client-tampering.html&quot;&gt;Users can change the price at checkout: stop trusting amounts sent from the browser to Stripe&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>App emails (sign-up, password reset, receipts) land in spam: fix SPF, DKIM and DMARC</title><link>https://unbreakmyapp.vercel.app/fixes/transactional-emails-going-to-spam-spf-dkim-dmarc.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/transactional-emails-going-to-spam-spf-dkim-dmarc.html</guid><pubDate>Tue, 27 Oct 2026 06:00:00 +0000</pubDate><category>Auth</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><category>Replit</category><category>v0</category><description>Mailbox providers decide where your email goes mostly by checking who is allowed to send for your domain.</description><content:encoded>&lt;p&gt;Mailbox providers decide where your email goes mostly by checking who is allowed to send for your domain.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Confirmation, magic link, password reset or receipt emails go to the Spam/Junk folder, show &amp;#x27;via&amp;#x27; or &amp;#x27;Be careful with this message&amp;#x27; in Gmail, or bounce with &amp;#x27;550 5.7.26 Unauthenticated email&amp;#x27; / &amp;#x27;This message does not pass authentication checks&amp;#x27;&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;Mailbox providers decide where your email goes mostly by checking who is allowed to send for your domain. SPF is a DNS record listing which servers may send for the domain, DKIM is a signature your email provider adds that&amp;#x27;s checked against a public key in your DNS, and DMARC is a record that tells receivers what to do when those checks fail and requires the domain in your From address to match (align with) the domain SPF or DKIM passed for. Vibe-coded apps often send from a provider like Resend, SendGrid, Postmark or AWS SES without finishing domain verification, use a From address on a domain they haven&amp;#x27;t verified (or a free @gmail.com address, which a third-party server can never authenticate), have two separate SPF records so SPF breaks entirely, or have no DMARC record at all. Since February 2024 Gmail and Yahoo require SPF or DKIM from every sender, and SPF, DKIM, DMARC and one-click unsubscribe for marketing mail from bulk senders, so unauthenticated app mail is filtered or rejected. Spammy content, link shorteners and brand-new domains with no sending history make it worse.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Find out what&amp;#x27;s failing first: send a test email to a Gmail address, open it, and choose More (three dots) → Show original. It lists SPF, DKIM and DMARC as PASS or FAIL and which domain each passed for.&lt;/li&gt;&lt;li&gt;Send from your own domain, ideally a subdomain such as mail.yourdomain.com or notifications.yourdomain.com, never from a @gmail.com or other free mailbox address. A subdomain keeps app mail&amp;#x27;s reputation separate from your normal inbox.&lt;/li&gt;&lt;li&gt;Verify that domain in your email provider (Resend, Postmark, SendGrid, AWS SES and so on) and add every DNS record it shows you exactly as given: the DKIM records (TXT or CNAME) and the SPF / return-path records. Wait until the dashboard says Verified.&lt;/li&gt;&lt;li&gt;Keep exactly one SPF TXT record per host name. If you already have one (for example for Google Workspace), add the new provider&amp;#x27;s include: to it rather than creating a second v=spf1 record, and stay under SPF&amp;#x27;s limit of 10 DNS lookups.&lt;/li&gt;&lt;li&gt;Add a DMARC record: a TXT record on _dmarc.yourdomain.com with a value like v=DMARC1; p=none; rua=mailto:dmarc@yourdomain.com. Start with p=none to collect reports, then move to p=quarantine once you&amp;#x27;re sure all your legitimate mail passes.&lt;/li&gt;&lt;li&gt;Make sure the From domain matches the domain DKIM signed for (or the SPF return-path domain), otherwise DMARC fails even though SPF and DKIM pass on their own.&lt;/li&gt;&lt;li&gt;Separate transactional email (receipts, password resets) from newsletters, add a working one-click unsubscribe to marketing mail, and avoid link shorteners and image-only emails. If you use Supabase Auth, point its custom SMTP settings at the verified domain.&lt;/li&gt;&lt;li&gt;Re-test with Show original, and if you send a lot to Gmail, watch your domain&amp;#x27;s reputation and spam rate in Google Postmaster Tools (Google asks bulk senders to stay below 0.3%).&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://www.rfc-editor.org/rfc/rfc7208&quot;&gt;RFC 7208: SPF&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.rfc-editor.org/rfc/rfc6376&quot;&gt;RFC 6376: DKIM&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.rfc-editor.org/rfc/rfc7489&quot;&gt;RFC 7489: DMARC&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/transactional-emails-going-to-spam-spf-dkim-dmarc.html&quot;&gt;App emails (sign-up, password reset, receipts) land in spam: fix SPF, DKIM and DMARC&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>App works on localhost but breaks in production: a checklist to find the cause</title><link>https://unbreakmyapp.vercel.app/fixes/works-on-localhost-breaks-in-production.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/works-on-localhost-breaks-in-production.html</guid><pubDate>Mon, 26 Oct 2026 06:00:00 +0000</pubDate><category>Deploys</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><category>Replit</category><category>v0</category><description>Your laptop and the AI builder&#x27;s preview quietly provide things production doesn&#x27;t. Locally you have a .env file, a dev server that rewrites every route to index.html, a localhost URL that every auth provider already trusts, a lenient dev build that ignores type errors, and a database you&#x27;re logged into as an admin.</description><content:encoded>&lt;p&gt;Your laptop and the AI builder&amp;#x27;s preview quietly provide things production doesn&amp;#x27;t. Locally you have a .env file, a dev server that rewrites every route to index.html, a localhost URL that every auth provider already trusts, a lenient dev build that ignores type errors, and a database you&amp;#x27;re logged into as an admin.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Works in the preview / on localhost, but the deployed site shows a blank page, &amp;#x27;Failed to fetch&amp;#x27;, &amp;#x27;undefined&amp;#x27; values, 404 on refresh, a login loop, a 500 from an API route, or a webhook that never fires&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;Your laptop and the AI builder&amp;#x27;s preview quietly provide things production doesn&amp;#x27;t. Locally you have a .env file, a dev server that rewrites every route to index.html, a localhost URL that every auth provider already trusts, a lenient dev build that ignores type errors, and a database you&amp;#x27;re logged into as an admin. In production each of those has to be configured on purpose: environment variables must be added in the hosting dashboard (and frontend ones need the right prefix, such as VITE_ or NEXT_PUBLIC_, at build time), the host needs a rewrite rule for client-side routes, auth providers and Stripe need the real domain, CORS must allow it, and your Row Level Security policies now apply to real signed-in users. Almost every &amp;#x27;works locally&amp;#x27; bug is one of these differences, so the fastest fix is to find which one, using the browser console and your host&amp;#x27;s logs rather than guessing.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Open the live site with DevTools open (Console and Network tabs) and reproduce the problem. Note the first red error and the first failed request (status code and URL). That one line usually tells you which area below it is.&lt;/li&gt;&lt;li&gt;Check your host&amp;#x27;s logs for the same moment: Vercel → Project → Logs (or Deployments → the deployment → Runtime Logs), Netlify Functions logs, Replit deployment logs, or Supabase → Logs for database, auth and edge functions. A 500 with no detail in the browser almost always has the real error here.&lt;/li&gt;&lt;li&gt;Environment variables: compare your local .env with the variables set in the hosting dashboard for the Production environment. Frontend variables need the framework&amp;#x27;s public prefix and a redeploy after you change them. Secret keys must stay server-only. &amp;#x27;undefined&amp;#x27; in the console or a request to &amp;#x27;undefined/rest/v1&amp;#x27; means a missing variable.&lt;/li&gt;&lt;li&gt;URLs: search the code for localhost, 127.0.0.1 and your preview URL. Replace hard-coded values with a config value, and add the production domain to Supabase Auth redirect URLs and Site URL, any Google or GitHub OAuth client, and your Stripe webhook endpoint.&lt;/li&gt;&lt;li&gt;Routing: if the home page works but refreshing or opening a deep link gives 404, the host needs a rewrite of all routes to index.html for a single-page app.&lt;/li&gt;&lt;li&gt;CORS and mixed content: a &amp;#x27;blocked by CORS policy&amp;#x27; or &amp;#x27;Mixed Content&amp;#x27; error means your API or edge function doesn&amp;#x27;t allow the production origin, or something is still called over http:// on an https:// site.&lt;/li&gt;&lt;li&gt;Build differences: if the deploy itself fails or the page is blank with a chunk or module error, run the production build locally (npm run build, then preview) and fix the first error it prints, often type errors or an import with the wrong letter case that only matters on Linux.&lt;/li&gt;&lt;li&gt;Data and permissions: if pages load but lists are empty or saves fail, test as a normal signed-in user, not as the dashboard admin. RLS policies, a fresh empty production database, or migrations that never ran are the usual causes.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://vercel.com/docs/environment-variables&quot;&gt;Vercel: Environment variables&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/auth/redirect-urls&quot;&gt;Supabase: Redirect URLs&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/works-on-localhost-breaks-in-production.html&quot;&gt;App works on localhost but breaks in production: a checklist to find the cause&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Lovable custom domain stuck on Verifying, SSL failing, or login broken after the switch</title><link>https://unbreakmyapp.vercel.app/fixes/lovable-custom-domain-stuck-verifying.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/lovable-custom-domain-stuck-verifying.html</guid><pubDate>Fri, 23 Oct 2026 06:00:00 +0000</pubDate><category>Deploys</category><category>Lovable</category><description>Lovable connects an external domain with two DNS records: an A record pointing to Lovable&#x27;s IP 185.158.133.1 and a TXT record on the host _lovable (or _lovable.&lt;subdomain&gt;) with a value starting lovable_verify=.</description><content:encoded>&lt;p&gt;Lovable connects an external domain with two DNS records: an A record pointing to Lovable&amp;#x27;s IP 185.158.133.1 and a TXT record on the host _lovable (or _lovable.&amp;lt;subdomain&amp;gt;) with a value starting lovable_verify=.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Domain status stuck on &amp;#x27;Verifying&amp;#x27; or &amp;#x27;Unable to verify&amp;#x27; / &amp;#x27;Setting up&amp;#x27;, &amp;#x27;Stalled&amp;#x27; or &amp;#x27;Failed&amp;#x27; (SSL) / browser security warning / Cloudflare error 1001 or 1003 / domain shows my old site / sign-in fails only on the new domain&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;Lovable connects an external domain with two DNS records: an A record pointing to Lovable&amp;#x27;s IP 185.158.133.1 and a TXT record on the host _lovable (or _lovable.&amp;lt;subdomain&amp;gt;) with a value starting lovable_verify=. Verification stalls when either record is wrong or incomplete (a truncated TXT value, the host entered as _lovable.yourdomain.com so it becomes doubled, or the A record on the wrong host), when old A, AAAA or CNAME records from a previous host are still there, or when Cloudflare proxying (orange cloud) is on for the A record. Once ownership is verified, SSL can still fail if the domain has CAA records that don&amp;#x27;t allow the certificate authorities Lovable uses. And when the domain finally goes live, login often breaks because the auth redirect URLs (in your own Supabase project, or Google OAuth) still only list the lovable.app address.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Open Project → Settings → Domains in Lovable and note the exact status and the exact A and TXT records it expects. You can also ask Lovable in the project chat which records it can and can&amp;#x27;t see.&lt;/li&gt;&lt;li&gt;Look the domain up with a public DNS checker (for example dnschecker.org) for A, AAAA, TXT and CAA. The A record should resolve to 185.158.133.1 only, and the TXT on _lovable should show the full lovable_verify= value.&lt;/li&gt;&lt;li&gt;Fix the records at your DNS provider: one A record to 185.158.133.1 (host @, blank or the domain name depending on the provider, or the subdomain label), the TXT on _lovable with the full value, and delete any leftover A, AAAA or CNAME records for the same host from your old site.&lt;/li&gt;&lt;li&gt;On Cloudflare, set the record to DNS only (grey cloud) during verification. If you really want Cloudflare in front, reconnect with the &amp;#x27;Uses Cloudflare or similar proxy&amp;#x27; option, which uses a CNAME to your lovable.app address instead.&lt;/li&gt;&lt;li&gt;If verification passed but the status is Setting up, Stalled or Failed, check CAA records on the domain and its parent. Allow at least one of pki.goog, letsencrypt.org or ssl.com (0 issue &amp;quot;letsencrypt.org&amp;quot;), then click Retry. Don&amp;#x27;t remove and re-add the domain just for an SSL stall.&lt;/li&gt;&lt;li&gt;Give DNS time: most changes apply within a few hours, but propagation can take up to 72 hours. Click Check status rather than repeatedly changing records, which restarts the wait.&lt;/li&gt;&lt;li&gt;Once Live, fix login on the new domain: if your app uses your own Supabase project, add https://yourdomain.com (and www) to Authentication → URL Configuration Redirect URLs and update the Site URL; if you use Google sign-in with your own OAuth client, add the new redirect URI in Google Cloud Console. Lovable&amp;#x27;s built-in backend adds the domain automatically.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://docs.lovable.dev/features/custom-domain&quot;&gt;Lovable: Custom domain&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://developers.cloudflare.com/dns/manage-dns-records/how-to/create-dns-records/&quot;&gt;Cloudflare: Create DNS records&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/lovable-custom-domain-stuck-verifying.html&quot;&gt;Lovable custom domain stuck on Verifying, SSL failing, or login broken after the switch&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Someone reported a security hole in my vibe-coded app: what to do first</title><link>https://unbreakmyapp.vercel.app/fixes/vibe-coded-app-security-hole-reported-first-steps.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/vibe-coded-app-security-hole-reported-first-steps.html</guid><pubDate>Thu, 22 Oct 2026 06:00:00 +0000</pubDate><category>Env vars &amp; leaked keys</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><category>Replit</category><category>v0</category><description>Apps generated by Lovable, Bolt, Cursor, Replit or v0 often ship with the same few holes: tables without Row Level Security, API routes that never check who owns a record, secret keys bundled into frontend code, and admin pages protected only by hiding the link.</description><content:encoded>&lt;p&gt;Apps generated by Lovable, Bolt, Cursor, Replit or v0 often ship with the same few holes: tables without Row Level Security, API routes that never check who owns a record, secret keys bundled into frontend code, and admin pages protected only by hiding the link.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;&amp;#x27;I can read other users&amp;#x27; data through your API&amp;#x27; / &amp;#x27;Your Supabase anon key lets anyone query every table&amp;#x27; / &amp;#x27;Your API key is visible in the page source&amp;#x27; (security report from a user or researcher)&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;Apps generated by Lovable, Bolt, Cursor, Replit or v0 often ship with the same few holes: tables without Row Level Security, API routes that never check who owns a record, secret keys bundled into frontend code, and admin pages protected only by hiding the link. Anyone who opens DevTools can find these, so reports arrive quickly once an app gets traffic. A report can be genuine, exaggerated, or a &amp;#x27;beg bounty&amp;#x27; asking for payment for a trivial or automated finding, so verify it before you panic, but treat any claim of data access as real until you&amp;#x27;ve proven otherwise.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Reply briefly to thank the reporter and say you&amp;#x27;re looking into it. Don&amp;#x27;t argue, threaten, or pay anything before you&amp;#x27;ve verified the issue, and don&amp;#x27;t share private data in the conversation.&lt;/li&gt;&lt;li&gt;Reproduce it yourself from a logged-out browser or a second test account: can you read or change data that isn&amp;#x27;t yours, call an admin route, or see a secret key in the page source or network tab?&lt;/li&gt;&lt;li&gt;If it&amp;#x27;s real, contain it first: rotate any exposed keys (Supabase service role, Stripe secret, OpenAI and similar), enable RLS on exposed tables, or temporarily disable the affected feature or route. Containment beats a perfect fix.&lt;/li&gt;&lt;li&gt;Fix the root cause: owner-scoped RLS policies using auth.uid(), server-side ownership checks on every API route that takes an id, secrets only in server environment variables, and real role checks on admin pages.&lt;/li&gt;&lt;li&gt;Check the damage: look at Supabase API and auth logs, your hosting logs and provider usage dashboards for unusual reads, exports or spend since the hole appeared. Keep notes and timestamps.&lt;/li&gt;&lt;li&gt;If personal data was actually accessed, check your notification duties. In the UK and EU, GDPR can require telling the data regulator within 72 hours of becoming aware of a reportable breach, and possibly the affected users. Get proper advice if unsure.&lt;/li&gt;&lt;li&gt;Close the loop: tell the reporter when it&amp;#x27;s fixed, add a security contact (for example a /.well-known/security.txt file), and re-test the whole app for the same class of bug, not just the one route reported.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://cheatsheetseries.owasp.org/cheatsheets/Error_Handling_Cheat_Sheet.html&quot;&gt;OWASP: Error Handling Cheat Sheet&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/postgres/row-level-security&quot;&gt;Supabase: Row Level Security&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/vibe-coded-app-security-hole-reported-first-steps.html&quot;&gt;Someone reported a security hole in my vibe-coded app: what to do first&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Supabase update says saved but the change is gone after refresh</title><link>https://unbreakmyapp.vercel.app/fixes/supabase-update-saved-but-gone-after-refresh.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/supabase-update-saved-but-gone-after-refresh.html</guid><pubDate>Wed, 21 Oct 2026 06:00:00 +0000</pubDate><category>Database / Supabase RLS</category><category>Lovable</category><category>Bolt</category><category>v0</category><category>Cursor</category><category>Replit</category><description>With Row Level Security on, an UPDATE only touches rows the current user is allowed to see and allowed to change. If no row passes the policies, Postgres simply updates 0 rows, and Supabase returns success with no error, so the AI-generated code shows &#x27;Saved&#x27; even though nothing was written.</description><content:encoded>&lt;p&gt;With Row Level Security on, an UPDATE only touches rows the current user is allowed to see and allowed to change. If no row passes the policies, Postgres simply updates 0 rows, and Supabase returns success with no error, so the AI-generated code shows &amp;#x27;Saved&amp;#x27; even though nothing was written.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;update() returns no error but nothing changes / { data: [], error: null } / &amp;#x27;Saved!&amp;#x27; toast, then the old value is back after a page refresh&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;With Row Level Security on, an UPDATE only touches rows the current user is allowed to see and allowed to change. If no row passes the policies, Postgres simply updates 0 rows, and Supabase returns success with no error, so the AI-generated code shows &amp;#x27;Saved&amp;#x27; even though nothing was written. The usual reasons: there is no UPDATE policy on the table at all; there is an UPDATE policy but no SELECT policy (Supabase&amp;#x27;s docs note an UPDATE also needs a matching SELECT policy, because Postgres has to read the row before it can update it); the policy checks a column such as user_id that the row doesn&amp;#x27;t actually have set for this user; the user isn&amp;#x27;t signed in, so the request runs as anon; or the .eq() filter targets the wrong id. Optimistic UI updates in the frontend make it look saved until the page reloads.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Prove it: chain .select() onto the update, e.g. supabase.from(&amp;#x27;profiles&amp;#x27;).update({name}).eq(&amp;#x27;id&amp;#x27;, id).select(). If data comes back as an empty array, 0 rows were updated.&lt;/li&gt;&lt;li&gt;In Supabase Dashboard → Authentication → Policies (or Table Editor → the table → RLS policies), check the table has both a SELECT policy and an UPDATE policy that cover this user&amp;#x27;s rows.&lt;/li&gt;&lt;li&gt;Write the UPDATE policy with both clauses, e.g. using (auth.uid() = user_id) with check (auth.uid() = user_id), and make sure a SELECT policy with the same ownership rule exists.&lt;/li&gt;&lt;li&gt;Check the row really belongs to the user: look at it in the Table Editor and confirm user_id (or owner_id) matches the signed-in user&amp;#x27;s id, and that rows created earlier weren&amp;#x27;t saved with a null owner.&lt;/li&gt;&lt;li&gt;Confirm the request is authenticated: log supabase.auth.getUser() just before the update. If it&amp;#x27;s null, the update runs as anon and no authenticated policy applies.&lt;/li&gt;&lt;li&gt;In the frontend, only show &amp;#x27;Saved&amp;#x27; after the update returns at least one row, and show an error otherwise, so silent failures can&amp;#x27;t hide again. Don&amp;#x27;t fix it by disabling RLS or using the service role key in the browser.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/postgres/row-level-security&quot;&gt;Supabase: Row Level Security&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/supabase-update-saved-but-gone-after-refresh.html&quot;&gt;Supabase update says saved but the change is gone after refresh&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Supabase confirmation, magic link or password reset emails not sending</title><link>https://unbreakmyapp.vercel.app/fixes/supabase-auth-emails-not-sending.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/supabase-auth-emails-not-sending.html</guid><pubDate>Tue, 20 Oct 2026 06:00:00 +0000</pubDate><category>Auth</category><category>Lovable</category><category>Bolt</category><category>v0</category><category>Cursor</category><category>Replit</category><description>Out of the box, Supabase Auth sends emails through a built-in SMTP server that is only meant for testing.</description><content:encoded>&lt;p&gt;Out of the box, Supabase Auth sends emails through a built-in SMTP server that is only meant for testing.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;email rate limit exceeded (429 over_email_send_rate_limit) / Email address not authorized / signup works but no confirmation email arrives&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;Out of the box, Supabase Auth sends emails through a built-in SMTP server that is only meant for testing. It refuses to send to anyone who isn&amp;#x27;t a member of your Supabase organisation&amp;#x27;s team (the &amp;#x27;Email address not authorized&amp;#x27; error) and it is limited to a very small number of messages per hour (Supabase&amp;#x27;s docs currently say 2 per hour), with no delivery guarantee. Apps built with Lovable, Bolt, v0, Cursor or Replit usually ship with that default, so sign-up confirmations, magic links, invites and password resets work for the builder and silently fail for real users. Other causes: emails landing in spam because there&amp;#x27;s no SPF/DKIM on a sending domain, and the confirmation link pointing at the wrong Site URL.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Check what actually happened: Supabase Dashboard → Logs → Auth logs show whether the email was attempted and the exact error (rate limit, not authorized, or SMTP failure).&lt;/li&gt;&lt;li&gt;Set up a custom SMTP provider (Resend, Postmark, AWS SES, SendGrid, Brevo or ZeptoMail) and enter its host, port, username, password and a From address such as no-reply@yourdomain.com in Supabase&amp;#x27;s Authentication settings under SMTP.&lt;/li&gt;&lt;li&gt;Verify your sending domain with that provider and add the SPF, DKIM and DMARC DNS records it gives you, so messages don&amp;#x27;t land in spam.&lt;/li&gt;&lt;li&gt;After enabling custom SMTP, Supabase starts you on a low email rate limit (30 per hour per the docs). Raise it on the Authentication → Rate Limits page to suit your traffic.&lt;/li&gt;&lt;li&gt;Confirm the Site URL and Redirect URLs in Authentication → URL Configuration point at your live domain so the email links work.&lt;/li&gt;&lt;li&gt;Turn on CAPTCHA protection for sign-up so bots can&amp;#x27;t burn your email quota or damage your sending reputation. Don&amp;#x27;t disable email confirmation just to make the problem go away.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/auth/auth-smtp&quot;&gt;Supabase: Send emails with custom SMTP&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/supabase-auth-emails-not-sending.html&quot;&gt;Supabase confirmation, magic link or password reset emails not sending&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Stripe webhook runs twice: duplicate orders, credits or double charges</title><link>https://unbreakmyapp.vercel.app/fixes/stripe-webhook-duplicate-events-double-charge.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/stripe-webhook-duplicate-events-double-charge.html</guid><pubDate>Mon, 19 Oct 2026 06:00:00 +0000</pubDate><category>Payments</category><category>Cursor</category><category>Bolt</category><category>Lovable</category><category>Replit</category><category>v0</category><description>Stripe delivers webhook events at least once, so the same event can arrive more than once, and Stripe retries any delivery that doesn&#x27;t get a fast 2xx response.</description><content:encoded>&lt;p&gt;Stripe delivers webhook events at least once, so the same event can arrive more than once, and Stripe retries any delivery that doesn&amp;#x27;t get a fast 2xx response.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;checkout.session.completed handled twice / user credited twice / customer charged twice for one purchase&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;Stripe delivers webhook events at least once, so the same event can arrive more than once, and Stripe retries any delivery that doesn&amp;#x27;t get a fast 2xx response. AI-generated handlers usually do the work (grant credits, create the order, send email) every time an event arrives, with no record of which event IDs were already processed. Other common causes: two webhook endpoints (or the Stripe CLI listener plus a Dashboard endpoint) pointing at the same app, handling both checkout.session.completed and payment_intent.succeeded for the same purchase, slow handlers that time out and get retried, and a pay button that can be clicked twice and creates two PaymentIntents or Checkout Sessions.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Store every processed event.id in a table with a unique constraint (e.g. processed_stripe_events(id text primary key)); insert first, and if the insert conflicts, return 200 and skip the work.&lt;/li&gt;&lt;li&gt;Make the business action itself idempotent too: upsert the order keyed by the Checkout Session or PaymentIntent id instead of inserting a new row each time.&lt;/li&gt;&lt;li&gt;Fulfil from one event type per purchase (usually checkout.session.completed for Checkout), not from several overlapping ones.&lt;/li&gt;&lt;li&gt;Verify the signature, record the event, return 2xx quickly, and do slow work (emails, AI calls) afterwards or in a background job so Stripe doesn&amp;#x27;t retry on timeout.&lt;/li&gt;&lt;li&gt;In Stripe Dashboard → Developers → Webhooks, check for duplicate endpoints subscribed to the same events, and stop stripe listen once a real endpoint exists.&lt;/li&gt;&lt;li&gt;Prevent real double charges at the source: disable the pay button after the first click and send an Idempotency-Key header (idempotencyKey option in stripe-node) on server-side create calls.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://docs.stripe.com/webhooks&quot;&gt;Stripe: Webhooks&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/stripe-webhook-duplicate-events-double-charge.html&quot;&gt;Stripe webhook runs twice: duplicate orders, credits or double charges&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Supabase table has RLS disabled (public Data API access)</title><link>https://unbreakmyapp.vercel.app/fixes/supabase-rls-disabled-table-public.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/supabase-rls-disabled-table-public.html</guid><pubDate>Fri, 16 Oct 2026 06:00:00 +0000</pubDate><category>Database / Supabase RLS</category><category>Lovable</category><category>Bolt</category><category>v0</category><category>Cursor</category><category>Replit</category><description>Lovable, Bolt, v0, Cursor and Replit often CREATE TABLE without enabling Row Level Security. The anon (publishable) key is meant to be public, but with RLS off anyone who has it can call PostgREST and select/insert/update/delete every row.</description><content:encoded>&lt;p&gt;Lovable, Bolt, v0, Cursor and Replit often CREATE TABLE without enabling Row Level Security. The anon (publishable) key is meant to be public, but with RLS off anyone who has it can call PostgREST and select/insert/update/delete every row.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Table Editor shows RLS disabled / anon key can read or write the whole table via REST / security scanner flags public table&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;Lovable, Bolt, v0, Cursor and Replit often CREATE TABLE without enabling Row Level Security. The anon (publishable) key is meant to be public, but with RLS off anyone who has it can call PostgREST and select/insert/update/delete every row. Shipping with the anon key and no RLS is the loudest security complaint about vibe-coded apps.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;In Supabase → Table Editor, open every table and turn RLS on (or run: alter table public.&amp;lt;TABLE&amp;gt; enable row level security;). Never leave RLS off in production.&lt;/li&gt;&lt;li&gt;Add least-privilege policies for the operations your app needs: SELECT, INSERT, UPDATE, DELETE, typically scoped with auth.uid() = user_id for authenticated users.&lt;/li&gt;&lt;li&gt;Grant anon access only when logged-out visitors must read specific public data; never give anon write access unless that is intentional and heavily constrained.&lt;/li&gt;&lt;li&gt;If the table was public while live, assume data was exposed: export what you need, rotate the anon key (Project Settings → API), and audit for leaked rows.&lt;/li&gt;&lt;li&gt;Repeat the audit for all tables (and storage.objects); AI builders often leave several tables open.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/postgres/row-level-security&quot;&gt;Supabase: Row Level Security&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/database-linter&quot;&gt;Supabase: Database Advisors (linter)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/supabase-rls-disabled-table-public.html&quot;&gt;Supabase table has RLS disabled (public Data API access)&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Supabase &quot;permission denied for table&quot; (42501) on a new table</title><link>https://unbreakmyapp.vercel.app/fixes/supabase-permission-denied-for-table.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/supabase-permission-denied-for-table.html</guid><pubDate>Thu, 15 Oct 2026 06:00:00 +0000</pubDate><category>Database / Supabase RLS</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><category>v0</category><category>Replit</category><description>Supabase no longer gives new tables in the public schema automatic Data API grants. Projects created since 30 May 2026 already work this way, and Supabase applies it to all existing projects on 30 October 2026.</description><content:encoded>&lt;p&gt;Supabase no longer gives new tables in the public schema automatic Data API grants. Projects created since 30 May 2026 already work this way, and Supabase applies it to all existing projects on 30 October 2026.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;{&amp;quot;code&amp;quot;:&amp;quot;42501&amp;quot;,&amp;quot;message&amp;quot;:&amp;quot;permission denied for table your_table&amp;quot;,&amp;quot;hint&amp;quot;:&amp;quot;Grant the required privileges to the current role with: GRANT SELECT ON public.your_table TO anon;&amp;quot;}&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;Supabase no longer gives new tables in the public schema automatic Data API grants. Projects created since 30 May 2026 already work this way, and Supabase applies it to all existing projects on 30 October 2026. Tables you already have keep their grants, but any table your AI builder creates afterwards is invisible to supabase-js until a migration runs GRANT for anon, authenticated and/or service_role. The error comes before RLS policies are even checked, so adding policies alone won&amp;#x27;t fix it, and it also hits edge functions using the service role key.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Confirm it&amp;#x27;s a grant problem: in the SQL Editor run select grantee, privilege_type from information_schema.role_table_grants where table_name = &amp;#x27;your_table&amp;#x27;; and check anon/authenticated/service_role are missing.&lt;/li&gt;&lt;li&gt;Grant only what each role needs, e.g. grant select, insert, update, delete on public.your_table to authenticated; and grant all on public.your_table to service_role;&lt;/li&gt;&lt;li&gt;Grant to anon only if logged-out visitors genuinely need to read that table.&lt;/li&gt;&lt;li&gt;Make sure RLS is enabled on the table and has policies, because a grant without RLS exposes every row.&lt;/li&gt;&lt;li&gt;If the table uses a serial/bigserial id, also grant usage on its sequence to every role that inserts.&lt;/li&gt;&lt;li&gt;Put the grants in the same migration that creates the table so future tables don&amp;#x27;t break the same way.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/changelog/45329-breaking-change-tables-not-exposed-to-data-and-graphql-api-automatically&quot;&gt;Supabase: Breaking change - tables not auto-exposed to Data API&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/postgres/row-level-security&quot;&gt;Supabase: Row Level Security&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/supabase-permission-denied-for-table.html&quot;&gt;Supabase &amp;quot;permission denied for table&amp;quot; (42501) on a new table&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Postgres error: relation &quot;public.xyz&quot; does not exist</title><link>https://unbreakmyapp.vercel.app/fixes/supabase-relation-does-not-exist.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/supabase-relation-does-not-exist.html</guid><pubDate>Wed, 14 Oct 2026 06:00:00 +0000</pubDate><category>Database / Supabase RLS</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><category>v0</category><description>The AI builder wrote TypeScript that queries a table, but the CREATE TABLE migration was never run on this Supabase project (or was run on a different project). Local/SQL editor and production can also point at different databases.</description><content:encoded>&lt;p&gt;The AI builder wrote TypeScript that queries a table, but the CREATE TABLE migration was never run on this Supabase project (or was run on a different project). Local/SQL editor and production can also point at different databases.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;ERROR: 42P01: relation &amp;quot;public.profiles&amp;quot; does not exist / PostgREST could not find the table&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;The AI builder wrote TypeScript that queries a table, but the CREATE TABLE migration was never run on this Supabase project (or was run on a different project). Local/SQL editor and production can also point at different databases. PostgREST only exposes tables that exist in the linked project&amp;#x27;s schema cache.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Open Supabase → Table Editor and confirm the table is missing on this project.&lt;/li&gt;&lt;li&gt;Find the migration or SQL the AI generated (often in supabase/migrations or a setup.sql).&lt;/li&gt;&lt;li&gt;Run it in the SQL Editor for the SAME project whose URL/anon key your app uses, or use supabase db push.&lt;/li&gt;&lt;li&gt;In Project Settings → API, click &amp;#x27;Reload schema&amp;#x27; if the table exists but the API still 404s.&lt;/li&gt;&lt;li&gt;Double-check NEXT_PUBLIC_SUPABASE_URL matches this project, not a leftover demo project.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/tables&quot;&gt;Supabase: Tables and data&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/api&quot;&gt;Supabase: API&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/supabase-relation-does-not-exist.html&quot;&gt;Postgres error: relation &amp;quot;public.xyz&amp;quot; does not exist&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>.env file committed to GitHub</title><link>https://unbreakmyapp.vercel.app/fixes/git-env-file-committed.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/git-env-file-committed.html</guid><pubDate>Tue, 13 Oct 2026 06:00:00 +0000</pubDate><category>Env vars &amp; leaked keys</category><category>Cursor</category><category>Replit</category><category>Bolt</category><description>The .env file wasn&#x27;t in .gitignore when the AI tool or you committed. Deleting it in a later commit doesn&#x27;t remove it from git history, and bots scrape public repos for keys within minutes.</description><content:encoded>&lt;p&gt;The .env file wasn&amp;#x27;t in .gitignore when the AI tool or you committed. Deleting it in a later commit doesn&amp;#x27;t remove it from git history, and bots scrape public repos for keys within minutes.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;GitHub secret scanning alert / .env visible in a public repo&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;The .env file wasn&amp;#x27;t in .gitignore when the AI tool or you committed. Deleting it in a later commit doesn&amp;#x27;t remove it from git history, and bots scrape public repos for keys within minutes.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Rotate every key that was in the file first.&lt;/li&gt;&lt;li&gt;Add .env* (except .env.example) to .gitignore and run git rm --cached .env.&lt;/li&gt;&lt;li&gt;Optionally purge history with git filter-repo, but rotation is what makes you safe.&lt;/li&gt;&lt;li&gt;Enable GitHub secret scanning and push protection.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://docs.github.com/en/code-security/secret-scanning/introduction/about-secret-scanning&quot;&gt;GitHub: About secret scanning&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/git-env-file-committed.html&quot;&gt;.env file committed to GitHub&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>OpenAI 429 &#x27;You exceeded your current quota&#x27; or a surprise AI bill</title><link>https://unbreakmyapp.vercel.app/fixes/openai-429-rate-limit-runaway-bill.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/openai-429-rate-limit-runaway-bill.html</guid><pubDate>Tue, 13 Oct 2026 06:00:00 +0000</pubDate><category>Env vars &amp; leaked keys</category><category>Cursor</category><category>Replit</category><category>Bolt</category><category>Lovable</category><description>Either the account has no credit or hit its spend limit, or something is calling the API far more than expected: a re-render loop, no rate limiting on your /api route, or a leaked key being used by someone else.</description><content:encoded>&lt;p&gt;Either the account has no credit or hit its spend limit, or something is calling the API far more than expected: a re-render loop, no rate limiting on your /api route, or a leaked key being used by someone else.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;429: You exceeded your current quota, please check your plan and billing details&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;Either the account has no credit or hit its spend limit, or something is calling the API far more than expected: a re-render loop, no rate limiting on your /api route, or a leaked key being used by someone else.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Check usage in the provider dashboard; if it&amp;#x27;s unexplained, revoke the key.&lt;/li&gt;&lt;li&gt;Set a monthly budget/limit in the provider&amp;#x27;s billing settings.&lt;/li&gt;&lt;li&gt;Add auth and per-user rate limiting to the server route that calls the AI API.&lt;/li&gt;&lt;li&gt;Retry 429s with exponential backoff, and cache repeated prompts.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://platform.openai.com/docs/guides/rate-limits&quot;&gt;OpenAI: Rate limits&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/openai-429-rate-limit-runaway-bill.html&quot;&gt;OpenAI 429 &amp;#x27;You exceeded your current quota&amp;#x27; or a surprise AI bill&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Hydration failed because the server rendered HTML didn&#x27;t match the client</title><link>https://unbreakmyapp.vercel.app/fixes/nextjs-hydration-mismatch.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/nextjs-hydration-mismatch.html</guid><pubDate>Tue, 13 Oct 2026 06:00:00 +0000</pubDate><category>Deploys</category><category>v0</category><category>Cursor</category><description>The component renders something different on the server and in the browser: dates/times, Math.random(), window/localStorage reads during render, invalid HTML nesting (a &lt;div&gt; inside a &lt;p&gt;), or browser extensions changing the DOM.</description><content:encoded>&lt;p&gt;The component renders something different on the server and in the browser: dates/times, Math.random(), window/localStorage reads during render, invalid HTML nesting (a &amp;lt;div&amp;gt; inside a &amp;lt;p&amp;gt;), or browser extensions changing the DOM.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Error: Hydration failed because the server rendered HTML didn&amp;#x27;t match the client&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;The component renders something different on the server and in the browser: dates/times, Math.random(), window/localStorage reads during render, invalid HTML nesting (a &amp;lt;div&amp;gt; inside a &amp;lt;p&amp;gt;), or browser extensions changing the DOM.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Move browser-only values (localStorage, window, Date.now()) into useEffect.&lt;/li&gt;&lt;li&gt;Fix invalid nesting such as &amp;lt;div&amp;gt; inside &amp;lt;p&amp;gt; or &amp;lt;a&amp;gt; inside &amp;lt;a&amp;gt;.&lt;/li&gt;&lt;li&gt;Use next/dynamic with ssr:false for browser-only components.&lt;/li&gt;&lt;li&gt;Test in an incognito window to rule out extensions.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://nextjs.org/docs/messages/react-hydration-error&quot;&gt;Next.js: Text content does not match server-rendered HTML&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/nextjs-hydration-mismatch.html&quot;&gt;Hydration failed because the server rendered HTML didn&amp;#x27;t match the client&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Supabase Storage upload fails: new row violates row-level security policy (403)</title><link>https://unbreakmyapp.vercel.app/fixes/supabase-storage-upload-403.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/supabase-storage-upload-403.html</guid><pubDate>Tue, 13 Oct 2026 06:00:00 +0000</pubDate><category>Database / Supabase RLS</category><category>Lovable</category><category>Bolt</category><category>v0</category><description>Supabase Storage is protected by RLS on storage.objects. A bucket without INSERT policies rejects uploads even when it&#x27;s &#x27;public&#x27; (public only affects reads).</description><content:encoded>&lt;p&gt;Supabase Storage is protected by RLS on storage.objects. A bucket without INSERT policies rejects uploads even when it&amp;#x27;s &amp;#x27;public&amp;#x27; (public only affects reads).&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;StorageApiError: new row violates row-level security policy (403 Unauthorized)&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;Supabase Storage is protected by RLS on storage.objects. A bucket without INSERT policies rejects uploads even when it&amp;#x27;s &amp;#x27;public&amp;#x27; (public only affects reads).&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Add an INSERT policy on storage.objects for the bucket, e.g. allowing authenticated users to upload into a folder named after their user id.&lt;/li&gt;&lt;li&gt;Upload to a path like `${user.id}/${filename}`.&lt;/li&gt;&lt;li&gt;Add SELECT/UPDATE/DELETE policies as needed (upsert needs UPDATE).&lt;/li&gt;&lt;li&gt;Keep the bucket private if files aren&amp;#x27;t meant to be public, and use signed URLs.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/storage/security/access-control&quot;&gt;Supabase: Storage access control&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/supabase-storage-upload-403.html&quot;&gt;Supabase Storage upload fails: new row violates row-level security policy (403)&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Too many re-renders / useEffect infinite loop</title><link>https://unbreakmyapp.vercel.app/fixes/useeffect-infinite-loop.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/useeffect-infinite-loop.html</guid><pubDate>Tue, 13 Oct 2026 06:00:00 +0000</pubDate><category>Performance</category><category>Lovable</category><category>Bolt</category><category>v0</category><category>Cursor</category><description>State is set during render, or a useEffect updates a value that&#x27;s also in its dependency array (often an object or array recreated each render), so it loops forever and can hammer your API.</description><content:encoded>&lt;p&gt;State is set during render, or a useEffect updates a value that&amp;#x27;s also in its dependency array (often an object or array recreated each render), so it loops forever and can hammer your API.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Error: Too many re-renders. React limits the number of renders / Maximum update depth exceeded&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;State is set during render, or a useEffect updates a value that&amp;#x27;s also in its dependency array (often an object or array recreated each render), so it loops forever and can hammer your API.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Never call setState directly in the component body.&lt;/li&gt;&lt;li&gt;Check useEffect dependencies; avoid objects/arrays created inline.&lt;/li&gt;&lt;li&gt;Memoise with useMemo/useCallback or depend on primitive ids.&lt;/li&gt;&lt;li&gt;Move data fetching to React Query/SWR.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://react.dev/learn/you-might-not-need-an-effect&quot;&gt;React: You Might Not Need an Effect&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://react.dev/reference/react/useEffect&quot;&gt;React: useEffect&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/useeffect-infinite-loop.html&quot;&gt;Too many re-renders / useEffect infinite loop&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>App is slow: dozens of database calls per page (N+1 queries)</title><link>https://unbreakmyapp.vercel.app/fixes/slow-page-n-plus-one-queries.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/slow-page-n-plus-one-queries.html</guid><pubDate>Tue, 13 Oct 2026 06:00:00 +0000</pubDate><category>Performance</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><category>v0</category><description>The AI-generated code fetches a list, then fetches related data separately for each item, often inside useEffect with no caching, and re-runs on every render.</description><content:encoded>&lt;p&gt;The AI-generated code fetches a list, then fetches related data separately for each item, often inside useEffect with no caching, and re-runs on every render.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Page takes 3-10s; network tab shows many identical requests&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;The AI-generated code fetches a list, then fetches related data separately for each item, often inside useEffect with no caching, and re-runs on every render.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Fetch related data in one query (Supabase: select(&amp;#x27;*, author:profiles(name)&amp;#x27;)).&lt;/li&gt;&lt;li&gt;Add indexes on foreign keys and columns you filter by.&lt;/li&gt;&lt;li&gt;Paginate lists (.range()).&lt;/li&gt;&lt;li&gt;Cache with React Query/SWR and fix useEffect dependency arrays.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/overview&quot;&gt;Supabase: Database overview&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/connecting-to-postgres&quot;&gt;Supabase: Connect to your database&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/slow-page-n-plus-one-queries.html&quot;&gt;App is slow: dozens of database calls per page (N+1 queries)&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Postgres: too many connections / remaining connection slots are reserved</title><link>https://unbreakmyapp.vercel.app/fixes/supabase-too-many-connections.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/supabase-too-many-connections.html</guid><pubDate>Tue, 13 Oct 2026 06:00:00 +0000</pubDate><category>Performance</category><category>Cursor</category><category>v0</category><category>Replit</category><description>Serverless functions each open their own direct database connection, so traffic spikes exhaust Postgres&#x27;s connection limit.</description><content:encoded>&lt;p&gt;Serverless functions each open their own direct database connection, so traffic spikes exhaust Postgres&amp;#x27;s connection limit.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;FATAL: sorry, too many clients already / remaining connection slots are reserved&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;Serverless functions each open their own direct database connection, so traffic spikes exhaust Postgres&amp;#x27;s connection limit. ORMs like Prisma create a new pool per cold start.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Use Supabase&amp;#x27;s pooled connection string (Supavisor, transaction mode, port 6543) for serverless.&lt;/li&gt;&lt;li&gt;With Prisma, use the pooled URL and add pgbouncer=true; keep a DIRECT_URL for migrations.&lt;/li&gt;&lt;li&gt;Reuse one client per instance (global singleton in dev).&lt;/li&gt;&lt;li&gt;Or use supabase-js over HTTP, which doesn&amp;#x27;t hold Postgres connections.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/connecting-to-postgres&quot;&gt;Supabase: Connect to your database&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/supabase-too-many-connections.html&quot;&gt;Postgres: too many connections / remaining connection slots are reserved&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Supabase Edge Function fails with CORS or &#x27;Failed to send a request&#x27;</title><link>https://unbreakmyapp.vercel.app/fixes/lovable-supabase-edge-function-cors.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/lovable-supabase-edge-function-cors.html</guid><pubDate>Tue, 13 Oct 2026 06:00:00 +0000</pubDate><category>Database / Supabase RLS</category><category>Lovable</category><category>Bolt</category><description>The Edge Function doesn&#x27;t answer the OPTIONS preflight with CORS headers, or it throws before returning headers.</description><content:encoded>&lt;p&gt;The Edge Function doesn&amp;#x27;t answer the OPTIONS preflight with CORS headers, or it throws before returning headers.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;FunctionsFetchError: Failed to send a request to the Edge Function / CORS preflight failed&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;The Edge Function doesn&amp;#x27;t answer the OPTIONS preflight with CORS headers, or it throws before returning headers. A missing secret (Deno.env.get returns undefined) commonly causes that crash.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Handle OPTIONS first: if (req.method === &amp;#x27;OPTIONS&amp;#x27;) return new Response(&amp;#x27;ok&amp;#x27;, { headers: corsHeaders })&lt;/li&gt;&lt;li&gt;Include corsHeaders on every response, errors included.&lt;/li&gt;&lt;li&gt;Set secrets with supabase secrets set NAME=value (or the Dashboard → Edge Functions → Secrets).&lt;/li&gt;&lt;li&gt;Check the function logs in the Supabase dashboard.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/functions/cors&quot;&gt;Supabase: CORS support for Edge Functions&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/lovable-supabase-edge-function-cors.html&quot;&gt;Supabase Edge Function fails with CORS or &amp;#x27;Failed to send a request&amp;#x27;&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Replit deploy: app not reachable / port not open</title><link>https://unbreakmyapp.vercel.app/fixes/replit-port-not-open.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/replit-port-not-open.html</guid><pubDate>Tue, 13 Oct 2026 06:00:00 +0000</pubDate><category>Deploys</category><category>Replit</category><description>The server listens on localhost/127.0.0.1 or a hard-coded port. Deployments need it bound to 0.0.0.0 on the port the platform gives you (process.env.PORT), and the health check expects a quick 200 on /.</description><content:encoded>&lt;p&gt;The server listens on localhost/127.0.0.1 or a hard-coded port. Deployments need it bound to 0.0.0.0 on the port the platform gives you (process.env.PORT), and the health check expects a quick 200 on /.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Your app is not listening on the expected port / deployment health check failed&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;The server listens on localhost/127.0.0.1 or a hard-coded port. Deployments need it bound to 0.0.0.0 on the port the platform gives you (process.env.PORT), and the health check expects a quick 200 on /.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Listen on 0.0.0.0 and process.env.PORT (with a fallback).&lt;/li&gt;&lt;li&gt;Make sure / responds quickly with 200.&lt;/li&gt;&lt;li&gt;Check the run command in the deployment config starts the production server.&lt;/li&gt;&lt;li&gt;Move secrets into Replit Secrets, which deployments read too.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://docs.replit.com/cloud-services/deployments/about-deployments&quot;&gt;Replit: About Deployments&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.replit.com/replit-app/configuration&quot;&gt;Replit: App configuration&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/replit-port-not-open.html&quot;&gt;Replit deploy: app not reachable / port not open&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>CORS error: blocked by CORS policy: No &#x27;Access-Control-Allow-Origin&#x27; header</title><link>https://unbreakmyapp.vercel.app/fixes/cors-error-fetch-blocked.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/cors-error-fetch-blocked.html</guid><pubDate>Tue, 13 Oct 2026 06:00:00 +0000</pubDate><category>Deploys</category><category>Cursor</category><category>Replit</category><category>Bolt</category><category>v0</category><description>The browser blocks cross-origin requests unless the server answers with Access-Control-Allow-Origin for your site (and handles the OPTIONS preflight).</description><content:encoded>&lt;p&gt;The browser blocks cross-origin requests unless the server answers with Access-Control-Allow-Origin for your site (and handles the OPTIONS preflight).&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Access to fetch at &amp;#x27;https://api...&amp;#x27; from origin &amp;#x27;https://...&amp;#x27; has been blocked by CORS policy&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;The browser blocks cross-origin requests unless the server answers with Access-Control-Allow-Origin for your site (and handles the OPTIONS preflight). Many third-party APIs deliberately don&amp;#x27;t allow browser calls because they need a secret key.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;If it&amp;#x27;s your API: return Access-Control-Allow-Origin for your exact domain and handle OPTIONS.&lt;/li&gt;&lt;li&gt;If it&amp;#x27;s a third-party API with a secret key: call it from your own server route instead.&lt;/li&gt;&lt;li&gt;Don&amp;#x27;t use public CORS proxies for anything with keys.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS&quot;&gt;MDN: Cross-Origin Resource Sharing (CORS)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/cors-error-fetch-blocked.html&quot;&gt;CORS error: blocked by CORS policy: No &amp;#x27;Access-Control-Allow-Origin&amp;#x27; header&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>404 NOT_FOUND when refreshing a page (React/Vite SPA)</title><link>https://unbreakmyapp.vercel.app/fixes/vercel-404-on-refresh-spa.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/vercel-404-on-refresh-spa.html</guid><pubDate>Tue, 13 Oct 2026 06:00:00 +0000</pubDate><category>Deploys</category><category>Lovable</category><category>Bolt</category><description>Vite/React Router apps are single-page apps: only index.html exists. The host looks for a /dashboard file, finds none and returns 404.</description><content:encoded>&lt;p&gt;Vite/React Router apps are single-page apps: only index.html exists. The host looks for a /dashboard file, finds none and returns 404.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;404: NOT_FOUND on /dashboard after refresh or when opening a direct link&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;Vite/React Router apps are single-page apps: only index.html exists. The host looks for a /dashboard file, finds none and returns 404. You need a rewrite to index.html.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;On Vercel add vercel.json: {&amp;quot;rewrites&amp;quot;:[{&amp;quot;source&amp;quot;:&amp;quot;/(.*)&amp;quot;,&amp;quot;destination&amp;quot;:&amp;quot;/index.html&amp;quot;}]}&lt;/li&gt;&lt;li&gt;On Netlify add public/_redirects with: /*  /index.html  200&lt;/li&gt;&lt;li&gt;Redeploy and test a deep link.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://vercel.com/docs/project-configuration#rewrites&quot;&gt;Vercel: Project Configuration (rewrites)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/vercel-404-on-refresh-spa.html&quot;&gt;404 NOT_FOUND when refreshing a page (React/Vite SPA)&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Vercel build fails: Type error / ESLint errors (works locally)</title><link>https://unbreakmyapp.vercel.app/fixes/vercel-build-failed-type-errors.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/vercel-build-failed-type-errors.html</guid><pubDate>Tue, 13 Oct 2026 06:00:00 +0000</pubDate><category>Deploys</category><category>Cursor</category><category>v0</category><category>Bolt</category><description>next dev doesn&#x27;t run a full type check, but next build does, and it fails on TypeScript and (in some versions) ESLint errors.</description><content:encoded>&lt;p&gt;next dev doesn&amp;#x27;t run a full type check, but next build does, and it fails on TypeScript and (in some versions) ESLint errors.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Failed to compile. Type error: ... / Error: Command &amp;quot;npm run build&amp;quot; exited with 1&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;next dev doesn&amp;#x27;t run a full type check, but next build does, and it fails on TypeScript and (in some versions) ESLint errors. Case-sensitive file imports also break on Linux build servers while working on Mac/Windows.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Run npm run build locally to reproduce.&lt;/li&gt;&lt;li&gt;Fix the reported type errors rather than disabling checks.&lt;/li&gt;&lt;li&gt;Check import paths match file names exactly, including case.&lt;/li&gt;&lt;li&gt;Make sure the lockfile is committed and the Node version matches.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://vercel.com/docs/deployments/troubleshoot-a-build&quot;&gt;Vercel: Troubleshoot a build&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/vercel-build-failed-type-errors.html&quot;&gt;Vercel build fails: Type error / ESLint errors (works locally)&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>No such price / No such customer (test vs live mode mix-up)</title><link>https://unbreakmyapp.vercel.app/fixes/stripe-test-vs-live-keys.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/stripe-test-vs-live-keys.html</guid><pubDate>Tue, 13 Oct 2026 06:00:00 +0000</pubDate><category>Payments</category><category>Cursor</category><category>Bolt</category><category>v0</category><category>Lovable</category><description>Objects created in test mode don&#x27;t exist in live mode and vice versa. Using a live secret key with test price IDs (or a key from a different account or sandbox) gives &#x27;No such ...&#x27; errors.</description><content:encoded>&lt;p&gt;Objects created in test mode don&amp;#x27;t exist in live mode and vice versa. Using a live secret key with test price IDs (or a key from a different account or sandbox) gives &amp;#x27;No such ...&amp;#x27; errors.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;StripeInvalidRequestError: No such price: &amp;#x27;price_...&amp;#x27;&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;Objects created in test mode don&amp;#x27;t exist in live mode and vice versa. Using a live secret key with test price IDs (or a key from a different account or sandbox) gives &amp;#x27;No such ...&amp;#x27; errors.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Check the key prefix: sk_test_ vs sk_live_.&lt;/li&gt;&lt;li&gt;Recreate products and prices in live mode (or copy them) and use the live IDs in production env vars.&lt;/li&gt;&lt;li&gt;Keep price IDs in env vars per environment, not hard-coded.&lt;/li&gt;&lt;li&gt;Confirm the key and price belong to the same account/sandbox.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://docs.stripe.com/keys&quot;&gt;Stripe: API keys&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/stripe-test-vs-live-keys.html&quot;&gt;No such price / No such customer (test vs live mode mix-up)&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Payment succeeds but the user isn&#x27;t upgraded</title><link>https://unbreakmyapp.vercel.app/fixes/stripe-payment-succeeds-but-app-not-updated.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/stripe-payment-succeeds-but-app-not-updated.html</guid><pubDate>Tue, 13 Oct 2026 06:00:00 +0000</pubDate><category>Payments</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><description>The app grants access on the success-page redirect, or no webhook is configured in production.</description><content:encoded>&lt;p&gt;The app grants access on the success-page redirect, or no webhook is configured in production.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Stripe shows the payment as succeeded but the app still shows the free plan&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;The app grants access on the success-page redirect, or no webhook is configured in production. Redirects can be skipped (closed tab), so access should be granted from the checkout.session.completed webhook, matched to the user via client_reference_id or metadata.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Pass client_reference_id (your user id) when creating the Checkout Session.&lt;/li&gt;&lt;li&gt;Add a production webhook endpoint in Stripe for checkout.session.completed (plus customer.subscription.updated/deleted for subscriptions).&lt;/li&gt;&lt;li&gt;In the handler, look up the user by client_reference_id and update their plan with a server-side DB client.&lt;/li&gt;&lt;li&gt;Make the handler idempotent (store the event id).&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://docs.stripe.com/checkout/fulfillment&quot;&gt;Stripe: Fulfill orders (Checkout)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.stripe.com/webhooks&quot;&gt;Stripe: Webhooks&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/stripe-payment-succeeds-but-app-not-updated.html&quot;&gt;Payment succeeds but the user isn&amp;#x27;t upgraded&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Stripe webhook: No signatures found matching the expected signature</title><link>https://unbreakmyapp.vercel.app/fixes/stripe-webhook-signature-failed.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/stripe-webhook-signature-failed.html</guid><pubDate>Tue, 13 Oct 2026 06:00:00 +0000</pubDate><category>Payments</category><category>Cursor</category><category>Bolt</category><category>Replit</category><category>v0</category><description>constructEvent needs the raw request body exactly as Stripe sent it. Frameworks that parse JSON first (Express json(), Next.js req.json()) change the body, so the signature fails.</description><content:encoded>&lt;p&gt;constructEvent needs the raw request body exactly as Stripe sent it. Frameworks that parse JSON first (Express json(), Next.js req.json()) change the body, so the signature fails.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;StripeSignatureVerificationError: No signatures found matching the expected signature for payload&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;constructEvent needs the raw request body exactly as Stripe sent it. Frameworks that parse JSON first (Express json(), Next.js req.json()) change the body, so the signature fails. A wrong webhook secret (CLI secret vs dashboard secret, test vs live) causes the same error.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Read the raw body: in Next.js App Router use await req.text(); in Express use express.raw({type: &amp;#x27;application/json&amp;#x27;}) on that route only.&lt;/li&gt;&lt;li&gt;Use the whsec_ secret for this exact endpoint and mode (stripe listen prints a different one).&lt;/li&gt;&lt;li&gt;Pass the stripe-signature header unchanged.&lt;/li&gt;&lt;li&gt;Return 200 quickly and do slow work afterwards.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://docs.stripe.com/webhooks/signature&quot;&gt;Stripe: Verify webhook signatures&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/stripe-webhook-signature-failed.html&quot;&gt;Stripe webhook: No signatures found matching the expected signature&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>User is logged out after page refresh</title><link>https://unbreakmyapp.vercel.app/fixes/session-lost-on-refresh.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/session-lost-on-refresh.html</guid><pubDate>Tue, 13 Oct 2026 06:00:00 +0000</pubDate><category>Auth</category><category>Lovable</category><category>Bolt</category><category>v0</category><description>The app checks for the user before the auth client has restored the session from storage, or it stores auth state only in React state.</description><content:encoded>&lt;p&gt;The app checks for the user before the auth client has restored the session from storage, or it stores auth state only in React state.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;After reload, user is null and protected pages redirect to /login&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;The app checks for the user before the auth client has restored the session from storage, or it stores auth state only in React state. With SSR (Next.js), the server can&amp;#x27;t see a session that lives only in localStorage.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Wait for the initial session (supabase.auth.getSession()) and show a loading state before redirecting.&lt;/li&gt;&lt;li&gt;Subscribe to onAuthStateChange to keep state in sync.&lt;/li&gt;&lt;li&gt;For Next.js SSR, use @supabase/ssr so the session lives in cookies and refresh it in middleware.&lt;/li&gt;&lt;li&gt;Don&amp;#x27;t create multiple Supabase clients with different storage settings.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/auth/sessions&quot;&gt;Supabase: User sessions&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/session-lost-on-refresh.html&quot;&gt;User is logged out after page refresh&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Error 400: redirect_uri_mismatch (Google sign-in)</title><link>https://unbreakmyapp.vercel.app/fixes/oauth-redirect-uri-mismatch.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/oauth-redirect-uri-mismatch.html</guid><pubDate>Tue, 13 Oct 2026 06:00:00 +0000</pubDate><category>Auth</category><category>Cursor</category><category>Replit</category><category>Bolt</category><description>The callback URL your app sends to Google isn&#x27;t listed exactly (scheme, domain, path, trailing slash) in Google Cloud Console → Credentials → OAuth client → Authorized redirect URIs.</description><content:encoded>&lt;p&gt;The callback URL your app sends to Google isn&amp;#x27;t listed exactly (scheme, domain, path, trailing slash) in Google Cloud Console → Credentials → OAuth client → Authorized redirect URIs.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Error 400: redirect_uri_mismatch. The redirect URI in the request does not match the ones authorized&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;The callback URL your app sends to Google isn&amp;#x27;t listed exactly (scheme, domain, path, trailing slash) in Google Cloud Console → Credentials → OAuth client → Authorized redirect URIs.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Copy the redirect_uri from the error details.&lt;/li&gt;&lt;li&gt;Add it exactly in Google Cloud Console → APIs &amp;amp; Services → Credentials → your OAuth client.&lt;/li&gt;&lt;li&gt;For NextAuth/Auth.js it&amp;#x27;s https://YOURDOMAIN/api/auth/callback/google; set NEXTAUTH_URL/AUTH_URL to your production URL.&lt;/li&gt;&lt;li&gt;Wait a few minutes for Google to propagate the change.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://developers.google.com/identity/protocols/oauth2/web-server&quot;&gt;Google: OAuth 2.0 for Web Server Applications&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.github.com/en/apps/oauth-apps/using-oauth-apps/authorizing-oauth-apps&quot;&gt;GitHub: Authorizing OAuth apps&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/oauth-redirect-uri-mismatch.html&quot;&gt;Error 400: redirect_uri_mismatch (Google sign-in)&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Magic link / OAuth login redirects to localhost:3000</title><link>https://unbreakmyapp.vercel.app/fixes/supabase-auth-redirect-localhost.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/supabase-auth-redirect-localhost.html</guid><pubDate>Tue, 13 Oct 2026 06:00:00 +0000</pubDate><category>Auth</category><category>Lovable</category><category>Bolt</category><category>v0</category><category>Cursor</category><description>Supabase Auth&#x27;s Site URL is still set to localhost, or your production URL isn&#x27;t in the Redirect URLs allow-list, so Supabase falls back to the Site URL.</description><content:encoded>&lt;p&gt;Supabase Auth&amp;#x27;s Site URL is still set to localhost, or your production URL isn&amp;#x27;t in the Redirect URLs allow-list, so Supabase falls back to the Site URL.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;After clicking the email link or Google login, the browser opens http://localhost:3000&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;Supabase Auth&amp;#x27;s Site URL is still set to localhost, or your production URL isn&amp;#x27;t in the Redirect URLs allow-list, so Supabase falls back to the Site URL.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Supabase → Authentication → URL Configuration: set Site URL to your production URL.&lt;/li&gt;&lt;li&gt;Add production and preview URLs to Redirect URLs (wildcards like https://*-yourteam.vercel.app/** are allowed).&lt;/li&gt;&lt;li&gt;Pass emailRedirectTo / redirectTo using window.location.origin.&lt;/li&gt;&lt;li&gt;For Google OAuth, the Google Cloud console redirect URI must be your Supabase callback URL (https://&amp;lt;ref&amp;gt;.supabase.co/auth/v1/callback).&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/auth/redirect-urls&quot;&gt;Supabase: Redirect URLs&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/supabase-auth-redirect-localhost.html&quot;&gt;Magic link / OAuth login redirects to localhost:3000&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Environment variable is undefined in production</title><link>https://unbreakmyapp.vercel.app/fixes/env-var-undefined-in-production.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/env-var-undefined-in-production.html</guid><pubDate>Tue, 13 Oct 2026 06:00:00 +0000</pubDate><category>Env vars &amp; leaked keys</category><category>Cursor</category><category>v0</category><category>Bolt</category><description>Your .env file is not uploaded when you deploy. Variables must be added in the hosting dashboard (Vercel, Netlify), and client-side values need the framework prefix (NEXT_PUBLIC_ for Next.js, VITE_ for Vite).</description><content:encoded>&lt;p&gt;Your .env file is not uploaded when you deploy. Variables must be added in the hosting dashboard (Vercel, Netlify), and client-side values need the framework prefix (NEXT_PUBLIC_ for Next.js, VITE_ for Vite).&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;process.env.X is undefined / import.meta.env.VITE_X is undefined after deploy&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;Your .env file is not uploaded when you deploy. Variables must be added in the hosting dashboard (Vercel, Netlify), and client-side values need the framework prefix (NEXT_PUBLIC_ for Next.js, VITE_ for Vite). Values are embedded at build time, so you must redeploy after adding them.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Add the variable in Vercel → Project → Settings → Environment Variables for Production (and Preview).&lt;/li&gt;&lt;li&gt;Use the right prefix for values the browser needs; keep secrets unprefixed and server-only.&lt;/li&gt;&lt;li&gt;Redeploy, since env changes apply only to new builds.&lt;/li&gt;&lt;li&gt;Log on the server whether the variable exists (never log its value).&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://vercel.com/docs/environment-variables&quot;&gt;Vercel: Environment variables&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/env-var-undefined-in-production.html&quot;&gt;Environment variable is undefined in production&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>OpenAI / Stripe secret key leaked in the browser</title><link>https://unbreakmyapp.vercel.app/fixes/api-key-leaked-in-frontend.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/api-key-leaked-in-frontend.html</guid><pubDate>Tue, 13 Oct 2026 06:00:00 +0000</pubDate><category>Env vars &amp; leaked keys</category><category>Lovable</category><category>Bolt</category><category>v0</category><category>Replit</category><category>Cursor</category><description>Calling a paid API directly from React puts the secret key into the JavaScript bundle. Any visitor can copy it and run up your bill.</description><content:encoded>&lt;p&gt;Calling a paid API directly from React puts the secret key into the JavaScript bundle. Any visitor can copy it and run up your bill.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;sk-... or sk_live_... visible in DevTools network tab or page source&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;Calling a paid API directly from React puts the secret key into the JavaScript bundle. Any visitor can copy it and run up your bill. Env vars prefixed VITE_ or NEXT_PUBLIC_ are embedded into client code at build time.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Revoke the leaked key in the provider dashboard right now and create a new one.&lt;/li&gt;&lt;li&gt;Store the new key in a server-only env var (no VITE_/NEXT_PUBLIC_ prefix).&lt;/li&gt;&lt;li&gt;Create a server route (/api/...) or edge function that calls the provider.&lt;/li&gt;&lt;li&gt;Have the frontend call your route, and add auth plus rate limiting to it.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://vercel.com/docs/environment-variables&quot;&gt;Vercel: Environment variables&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/api-key-leaked-in-frontend.html&quot;&gt;OpenAI / Stripe secret key leaked in the browser&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Supabase service_role key exposed in frontend code</title><link>https://unbreakmyapp.vercel.app/fixes/supabase-service-role-key-exposed.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/supabase-service-role-key-exposed.html</guid><pubDate>Tue, 13 Oct 2026 06:00:00 +0000</pubDate><category>Env vars &amp; leaked keys</category><category>Lovable</category><category>Bolt</category><category>v0</category><category>Cursor</category><description>The service_role key bypasses Row Level Security entirely. If it is in client code or in any NEXT_PUBLIC_/VITE_ variable, anyone can open DevTools, copy it and read or delete your whole database.</description><content:encoded>&lt;p&gt;The service_role key bypasses Row Level Security entirely. If it is in client code or in any NEXT_PUBLIC_/VITE_ variable, anyone can open DevTools, copy it and read or delete your whole database.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;service_role key found in the JS bundle / NEXT_PUBLIC_SUPABASE_SERVICE_ROLE_KEY&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;The service_role key bypasses Row Level Security entirely. If it is in client code or in any NEXT_PUBLIC_/VITE_ variable, anyone can open DevTools, copy it and read or delete your whole database.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Rotate the key immediately in Supabase → Project Settings → API (rotate JWT secret / API keys).&lt;/li&gt;&lt;li&gt;Remove it from all client-side code and public env vars.&lt;/li&gt;&lt;li&gt;Use only the anon/publishable key in the browser and rely on RLS.&lt;/li&gt;&lt;li&gt;Move privileged operations into a server route or Supabase Edge Function that reads the secret from server-side env.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/api/api-keys&quot;&gt;Supabase: Understanding API keys&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/supabase-service-role-key-exposed.html&quot;&gt;Supabase service_role key exposed in frontend code&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>new row violates row-level security policy for table</title><link>https://unbreakmyapp.vercel.app/fixes/supabase-rls-new-row-violates-policy.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/supabase-rls-new-row-violates-policy.html</guid><pubDate>Tue, 13 Oct 2026 06:00:00 +0000</pubDate><category>Database / Supabase RLS</category><category>Lovable</category><category>Bolt</category><category>Cursor</category><description>An INSERT or UPDATE was attempted on a table with RLS enabled, but no INSERT policy (WITH CHECK) allows it, or the row&#x27;s owner column doesn&#x27;t match auth.uid().</description><content:encoded>&lt;p&gt;An INSERT or UPDATE was attempted on a table with RLS enabled, but no INSERT policy (WITH CHECK) allows it, or the row&amp;#x27;s owner column doesn&amp;#x27;t match auth.uid().&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;new row violates row-level security policy for table &amp;quot;profiles&amp;quot; (code 42501)&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;An INSERT or UPDATE was attempted on a table with RLS enabled, but no INSERT policy (WITH CHECK) allows it, or the row&amp;#x27;s owner column doesn&amp;#x27;t match auth.uid(). Common when the app inserts before the user is signed in, or forgets to set user_id.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Confirm the user is authenticated when the insert runs.&lt;/li&gt;&lt;li&gt;Set the owner column (user_id) to the signed-in user&amp;#x27;s id, or give it a default of auth.uid().&lt;/li&gt;&lt;li&gt;Add an INSERT policy: create policy &amp;quot;insert own&amp;quot; on public.profiles for insert to authenticated with check (auth.uid() = user_id);&lt;/li&gt;&lt;li&gt;If you upsert, you also need an UPDATE policy.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/postgres/row-level-security&quot;&gt;Supabase: Row Level Security&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/supabase-rls-new-row-violates-policy.html&quot;&gt;new row violates row-level security policy for table&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
<item><title>Supabase query returns an empty array (no error)</title><link>https://unbreakmyapp.vercel.app/fixes/supabase-rls-empty-results.html</link><guid isPermaLink="true">https://unbreakmyapp.vercel.app/fixes/supabase-rls-empty-results.html</guid><pubDate>Tue, 13 Oct 2026 06:00:00 +0000</pubDate><category>Database / Supabase RLS</category><category>Lovable</category><category>Bolt</category><category>v0</category><description>Row Level Security is enabled on the table but there is no SELECT policy that matches the current user (or the user isn&#x27;t signed in). With RLS on and no matching policy, Postgres silently filters every row instead of throwing an error.</description><content:encoded>&lt;p&gt;Row Level Security is enabled on the table but there is no SELECT policy that matches the current user (or the user isn&amp;#x27;t signed in). With RLS on and no matching policy, Postgres silently filters every row instead of throwing an error.&lt;/p&gt;&lt;h2&gt;Error&lt;/h2&gt;&lt;p&gt;&lt;code&gt;data: [] (select works in the SQL editor but returns nothing in the app)&lt;/code&gt;&lt;/p&gt;&lt;h2&gt;Why it happens&lt;/h2&gt;&lt;p&gt;Row Level Security is enabled on the table but there is no SELECT policy that matches the current user (or the user isn&amp;#x27;t signed in). With RLS on and no matching policy, Postgres silently filters every row instead of throwing an error. The SQL editor runs as a superuser, so it bypasses RLS and hides the problem.&lt;/p&gt;&lt;h2&gt;Fix&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Open Supabase → Table Editor → the table → check &amp;#x27;RLS enabled&amp;#x27;.&lt;/li&gt;&lt;li&gt;Go to Authentication → Policies and confirm a SELECT policy exists for the right role (authenticated or anon).&lt;/li&gt;&lt;li&gt;Make sure the client request carries the user&amp;#x27;s session (supabase.auth.getSession() returns a user).&lt;/li&gt;&lt;li&gt;Add a policy such as: create policy &amp;quot;read own rows&amp;quot; on public.todos for select to authenticated using (auth.uid() = user_id);&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Sources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://supabase.com/docs/guides/database/postgres/row-level-security&quot;&gt;Supabase: Row Level Security&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Copy-paste prompt and FAQ: &lt;a href=&quot;https://unbreakmyapp.vercel.app/fixes/supabase-rls-empty-results.html&quot;&gt;Supabase query returns an empty array (no error)&lt;/a&gt;&lt;/p&gt;</content:encoded></item>
</channel></rss>
