rphlmr / supa-fly-stack

The Remix Stack for deploying to Fly with Supabase, authentication, testing, linting, formatting, etc.
MIT License
289 stars 26 forks source link

Error when running npm run setup (setup:seed) #63

Closed jkohlin closed 1 year ago

jkohlin commented 1 year ago

This is what I get:

Running seed command `ts-node --require tsconfig-paths/register app/database/seed.server.ts` ...
Error: Could not create or get user
    at getUserId (/Users/kojo/kod/Egna/YouWish/youwish_app/app/database/seed.server.ts:35:9)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async seed (/Users/kojo/kod/Egna/YouWish/youwish_app/app/database/seed.server.ts:39:14)

An error occurred while running the seed command:
Error: Command failed with exit code 1: ts-node --require tsconfig-paths/register app/database/seed.server.ts
ERROR: "setup:seed" exited with 1.

Any clues? I followed every step and created the shadow db as described in supabase docs

rphlmr commented 1 year ago

Any chance you already have a user with email hello@supabase.com in auth dashboard? (maybe you already try to seed and try again?)

Something goes wrong in the script and it hides supabase error 😅. will try to test asap ;)

jkohlin commented 1 year ago

nope, no users at all, either in public/users or auth/users However, I see a ts error in seed.server.ts: Module '"@prisma/client"' has no exported member 'PrismaClient'.

rphlmr commented 1 year ago

I’m far from my computer, but you can try to add a .catch(console.error) line 31 of https://github.com/rphlmr/supa-fly-stack/blob/main/app/database/seed.server.ts Should tell you what happen. Or, stil in line 31, next to data, you can destruct "error" and log it.

jkohlin commented 1 year ago

const newUserId... returns 'fetch failed'

AuthRetryableFetchError: fetch failed
    at /Users/kojo/kod/Egna/YouWish/youwish_app/node_modules/@supabase/gotrue-js/src/lib/fetch.ts:33:12
    at Generator.next (<anonymous>)
    at /Users/kojo/kod/Egna/YouWish/youwish_app/node_modules/@supabase/gotrue-js/dist/main/lib/fetch.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/kojo/kod/Egna/YouWish/youwish_app/node_modules/@supabase/gotrue-js/dist/main/lib/fetch.js:4:12)
    at handleError (/Users/kojo/kod/Egna/YouWish/youwish_app/node_modules/@supabase/gotrue-js/src/lib/fetch.ts:30:78)
    at /Users/kojo/kod/Egna/YouWish/youwish_app/node_modules/@supabase/gotrue-js/src/lib/fetch.ts:121:25
    at processTicksAndRejections (node:internal/process/task_queues:95:5) {
  __isAuthError: true,
  status: 0
}
rphlmr commented 1 year ago

I have push a better error handling in seed script.

Shadow DB is no more required if you just have created a Supabase project, so I have also remove this part.

The error you linked says that fetch failed (the Supabase SDK internal fetch). Could be a temporary issue from Supabase?

PS : I can't reproduce from a fresh install :/

jkohlin commented 1 year ago

Aha, you don’t need the shadow db? How do I remove it? I’m new to Postgres

On Fri, 10 Feb 2023 at 17:28 Raphaël Moreau @.***> wrote:

I have push a better error handling in seed script.

Shadow DB is no more required if you just have created a Supabase project, so I have also remove this part.

The error you linked says that fetch failed (the Supabase SDK internal fetch). Could be a temporary issue from Supabase?

— Reply to this email directly, view it on GitHub https://github.com/rphlmr/supa-fly-stack/issues/63#issuecomment-1426050364, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7MD4KS3TPI3FQNOE23B5TWWZUCJANCNFSM6AAAAAAUXA5BUI . You are receiving this because you authored the thread.Message ID: @.***>

-- /Johan

rphlmr commented 1 year ago

If it's just a new project, easiest is to delete it and recreate 😅

Or keep it and just remove the env in the prisma file like the commit i did.

jkohlin commented 1 year ago

Alright, thanks!

rphlmr commented 1 year ago

I hope it's fine for you ;)

Feel free to reopen if you still have an issue.