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

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

Closed
jkohlin opened this issue Feb 9, 2023 · 9 comments
Closed

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

jkohlin opened this issue Feb 9, 2023 · 9 comments
Assignees

Comments

@jkohlin
Copy link

jkohlin commented Feb 9, 2023

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
Copy link
Owner

rphlmr commented Feb 9, 2023

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
Copy link
Author

jkohlin commented Feb 9, 2023

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
Copy link
Owner

rphlmr commented Feb 9, 2023

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
Copy link
Author

jkohlin commented Feb 10, 2023

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
Copy link
Owner

rphlmr commented Feb 10, 2023

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?

  • Status "0" seems related to a network issue :s

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

@rphlmr rphlmr self-assigned this Feb 10, 2023
@jkohlin
Copy link
Author

jkohlin commented Feb 10, 2023 via email

@rphlmr
Copy link
Owner

rphlmr commented Feb 10, 2023

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
Copy link
Author

jkohlin commented Feb 11, 2023

Alright, thanks!

@rphlmr
Copy link
Owner

rphlmr commented Feb 22, 2023

I hope it's fine for you ;)

Feel free to reopen if you still have an issue.

@rphlmr rphlmr closed this as completed Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants