Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Netlify deployment: Randomly returns 404 on requesting my-site.netlify.app/api/_supabase/session #146

Closed
anderslutzhoft opened this issue Jan 19, 2023 · 11 comments
Labels
bug Something isn't working

Comments

@anderslutzhoft
Copy link

Version

"@nuxtjs/supabase": "^0.3.0",
"nuxt": "3.0.0"

Reproduction Link

N/A

Steps to reproduce

Make an auth request using useSupabaseClient().auth.signInWithPassword(), or useSupabaseClient().auth.signOut().

What is Expected?

Requests to APIs is expected to be stable.

What is actually happening?

When deoplyed to Netlify, using eg. useSupabaseClient().auth.signInWithPassword() randomly returns a 404 requesting my-site.netlify.app/api/_supabase/session.
A page refresh seems to solve the issue until next auth event.

Chrome console output:
POST https://budgetpie-beta.netlify.app/api/_supabase/session 404

Uncaught (in promise) FetchError: 404 (/api/_supabase/session)
at async Object.callback (entry.d286fcba.js:9:118483)

Aside from needing this workaround #144 everything works fine on local deployment.

@anderslutzhoft anderslutzhoft added the bug Something isn't working label Jan 19, 2023
@bauhem
Copy link

bauhem commented Jan 23, 2023

Same here, using Netlify, "@nuxtjs/supabase": "0.3.0" and "nuxt": "^3.0.0"

@bauhem
Copy link

bauhem commented Jan 23, 2023

I can confirm that this bug appear on Netlify but not on Vercel. My nuxt supabase setup work in Vercel.

@bauhem
Copy link

bauhem commented Jan 25, 2023

We need to use : nuxt build instead of nuxt generate to make this work on Netlify

@kiselev3
Copy link

kiselev3 commented Jan 26, 2023

I'm getting the same 404 error if I locally run nuxt generate and upload everything from dist folder to vercel or netlify.

image

image

@Aybee5
Copy link

Aybee5 commented Jan 27, 2023

Make sure you are using pnpm build script to deploy

@marc-tech
Copy link

+1

Copy link

wrightd commented Feb 16, 2023

I'm seeing this same issue when building/deploying for Cloudflare Pages. I'm using build then generate to create a static site.
Does next-supabase support static (JAMSTACK-style) deployment? It looks like it's requiring an API accessible via POST.
Is there some switch you need to set to make it support static sites, or is that just not available right now?

@Aybee5
Copy link

Aybee5 commented Feb 17, 2023

I'm seeing this same issue when building/deploying for Cloudflare Pages. I'm using build then generate to create a static site.
Does next-supabase support static (JAMSTACK-style) deployment? It looks like it's requiring an API accessible via POST.
Is there some switch you need to set to make it support static sites, or is that just not available right now?

I will recommend you update your build command to npm run build based on this https://nitro.unjs.io/deploy/providers/netlify

@marc-tech
Copy link

I guess this is a proxy probleme : https://docs.netlify.com/routing/redirects/rewrites-proxies/

@1boch1
Copy link

1boch1 commented Apr 2, 2023

We need to use : nuxt build instead of nuxt generate to make this work on Netlify

I'm using Nuxt3 (SSR: false) and SupabaseNuxt on a Nginx server hosted on Oracle Cloud, with "npm run generate" I get that error (404 /api/_supabase....) and with "npm run build" the index.html file doesn't get generated, so how can I deploy using "npm run build" if it is the solution? Thanks

@1boch1
Copy link

1boch1 commented Apr 2, 2023

I'm seeing this same issue when building/deploying for Cloudflare Pages. I'm using build then generate to create a static site.
Does next-supabase support static (JAMSTACK-style) deployment? It looks like it's requiring an API accessible via POST.
Is there some switch you need to set to make it support static sites, or is that just not available right now?

Did you find something new?

@PhE PhE mentioned this issue Apr 13, 2023
3 tasks
@larbish larbish closed this as not planned Won't fix, can't repro, duplicate, stale Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants