SupabaseS
Supabaseβ€’3y ago
koby

[solved] CORS Error on local development with NextJS and Supabase

heyho, I've a question regarding supabase local development CORS policy.

My nextjs App is on localhost:3000 and supabase local docker container on localhost:5432X.

Everytime I make a request for data, or try to use the signup functions i get a CORS related error:

Access to fetch at 'http://localhost:54324/auth/v1/token?grant_type=password' from origin 'https://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.


And I really can't get my head around that, I don't find any documentation or help to get my request get trough on local development.

If I use the DB directly from a supabase URL, f.ex.: https://xxx.supabase.co it works just fine. But i really want to operate directly on a local environment and not use the web application for my app at the moment.

The request I make for example, to login is like that:

supabase.auth.signInWithPassword({
  email: 'email@xyz.dev', 
  password: 'xyz1234',
})


Can somebody tell me what I do wrong here?
Was this page helpful?