netlify-templates / kpop-stack

Create a Remix app with Netlify, Tailwind, TypeScript and more!
https://kpop-stack.netlify.app
241 stars 65 forks source link

/join trying to create a user - Cannot read properties of null (reading 'id') #58

Open LukeXF opened 2 years ago

LukeXF commented 2 years ago

All three env vars are filled out correctly - how can I see which line this corresponds to?


    at action5 (/var/task/.netlify/functions-internal/server.js:747:18)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at Object.callRouteAction (/var/task/node_modules/@remix-run/server-runtime/data.js:40:14)
    at handleDataRequest (/var/task/node_modules/@remix-run/server-runtime/server.js:94:18)
    at requestHandler (/var/task/node_modules/@remix-run/server-runtime/server.js:34:18)
    at Runtime.handler (/var/task/node_modules/@remix-run/netlify/server.js:36:20)```
maxcell commented 2 years ago

Howdy @LukeXF! Oh dang that's a small set of stack trace, so it might take me a bit to figure out what it could be. Thank you for letting me know you put all the environment variables in. Just wanted to check, did you also make sure to perform the migrations to the Supabase database under https://github.com/netlify-templates/kpop-stack#database in the SQL Queries drop down

Here's the screenshot of the section from the README: CleanShot 2022-07-18 at 13 27 08

Dax911 commented 1 year ago

Also running into this. I'm fairly confident I did it correctly, I even deleted the whole database and followed the instructions step by step.

maxcell commented 1 year ago

@Dax911 Could you try to turn off the RLS policies and try again for me? It will say "Disable RLS" instead of where mine says "Enable RLS" CleanShot 2022-10-18 at 11 26 27

Dax911 commented 1 year ago

Standby.

Dax911 commented 1 year ago

No same issue... just to confirm SUPABASE_ANON_KEY is anon public, and SESSION_SECRECT is JWT secret?

maxcell commented 1 year ago

The SUPABASE_ANON_KEY is the anon public yup! But the SESSION_SECRET is actually whatever you'd want it to be, but you can also use the JWT Secret if you'd want! The SESSION_SECRET is for the Remix app to essentially do a hashing for the session storage but not actually from Supabase.

I forgot to indicate to also update the profiles policies and make sure that it is also disabled, if that doesn't make it work then I will keep investigating! CleanShot 2022-10-18 at 11 34 00

Dax911 commented 1 year ago

OHHHHH should have prob read that part of the code... would have seen that huh... I am trying one more time w a new db. Standby.

Dax911 commented 1 year ago

Ok I figured it out... If there is anything here from a previous db even if you overwrote it there are still migrations and schema information in the supabase tables. This is what is throwing the error it amounts to incompatibility. Just delete the supabase project and try again. Do not try and clean up an old project. The RLS stuff was a non issue upon starting the new new project.

maxcell commented 1 year ago

Oh interesting, this is super helpful!! Thank you so much @Dax911!

no-name-max commented 1 year ago

I ran into a similar error. If you go to your Netlify project select "Functions" and select "server" you should be able to see logs that include the failed requests. I posted a potential solution here: https://github.com/netlify-templates/kpop-stack/issues/101#issuecomment-1312611359

storyworks commented 1 year ago

I got the same issue as Dax911. No need to delete the entire supabase project, deleting the existing users was sufficient:

image

This is assuming you've correctly set the SUPABASE_URL, SUPABASE_ANON_KEY, SESSION_SECRET and have added the queries from the readme.