Dhravya / cloudflare-saas-stack

Quickly make and deploy full-stack apps with database, auth, styling, storage etc. figured out for you. Add all primitives you want.
3.09k stars 231 forks source link

Internal Server Error at startup #42

Closed LouisDeconinck closed 2 months ago

LouisDeconinck commented 2 months ago

I just followed these instructions

git clone https://github.com/Dhravya/cloudflare-saas-stack
cd cloudflare-saas-stack
npm i -g bun
bun install
bun run setup

I made sure I used wrangler login and provided Google IDs and a Cloudflare D1 database name.

When I then go to localhost:3000 I get an Internal Server Error.

These are my logs. Any idea what might be going on and how I can solve this?

◇  Remote database migrations completed.
Running bun run dev command...
$ turbo dev
turbo 2.1.0

 WARNING  stale pid file at "C:\\Users\\Maryse\\AppData\\Local\\Temp\\turbod\\5301d13bdb101210\\turbod.pid"
• Packages in scope: @repo/shared-types, @repo/tailwind-config, @repo/typescript-config, @repo/ui, web
• Running dev in 5 packages
• Remote caching disabled
web:dev: cache bypass, force executing dd67f2cfb17bd9d6
web:dev: $ next dev
web:dev: Using vars defined in .dev.vars
web:dev: Using vars defined in .dev.vars
web:dev:   ▲ Next.js 14.2.7
web:dev:   - Local:        http://localhost:3000
web:dev: 
web:dev:  ✓ Starting...
web:dev:  ✓ Ready in 4.2s
web:dev:  ○ Compiling / ...
web:dev:  ✓ Compiled / in 8.6s (1131 modules)
web:dev:  ⨯ Internal error: TypeError: Cannot read properties of undefined (reading 'default')
web:dev:     at resolveClientReference (../../node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js:87:55)
web:dev:     at resolveModule (../../node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js:1667:35)
web:dev:     at processFullRow (../../node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js:1740:25)
web:dev:     at processBinaryChunk (../../node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js:1858:21)
web:dev:     at progress (../../node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js:1926:17)
web:dev: digest: "1732920403"
web:dev: Query: select count(*) from "user"
web:dev: [TypeError: Cannot read properties of undefined (reading 'default')]
web:dev:  ⨯ [TypeError: Cannot read properties of undefined (reading 'default')]
web:dev:  ⨯ [TypeError: Cannot read properties of null (reading 'default')]
web:dev:  GET / 500 in 9334ms

During the setup I also go this: Blocked 3 postinstalls. Run bun pm untrusted for details.

I am using PowerShell on Windows.

LouisDeconinck commented 2 months ago

Possibly it is this issue with NextJS, Turborepo & Windows: https://github.com/vercel/next.js/issues/53562

Could try WSL, but would really prefer if this worked on Windows as well. Anyone have a work around?

Dhravya commented 2 months ago

This error usually happens when the local database is not setup correctly. can you try:

  1. Delete the .wrangler/ folder
  2. cd apps/web && bunx drizzle-kit generate --name setup
  3. then, bunx wrangler d1 migrations apply ${dbName} (in apps/web folder)
Dhravya commented 2 months ago

closing, continue the conversation in #38!