sadmann7 / skateshop

An open source e-commerce skateshop build with everything new in Next.js.
https://skateshop.sadmn.com
MIT License
5.23k stars 745 forks source link

Cant add Store #63

Closed ThamsanQue closed 1 year ago

ThamsanQue commented 1 year ago

Hello, ive installed the project and added all the env variables but changed the db to local mysql other than planetscale....im trying to add a store from the web app itself but i get this error : SyntaxError: await is only valid in async functions and the top level bodies of modules at (actionBrowser)/./src/db/index.ts (C:\Users\thams\Garage\skateshop\.next\server\app\(dashboard)\dashboard\stores\new\page.js:12791:1) at __webpack_require__ (C:\Users\thams\Garage\skateshop\.next\server\webpack-runtime.js:33:43) at eval (./src/app/_actions/store.ts:11:61) at (actionBrowser)/./src/app/_actions/store.ts (C:\Users\thams\Garage\skateshop\.next\server\app\(dashboard)\dashboard\stores\new\page.js:12089:1)

Any idea what might be wrong

sadmann7 commented 1 year ago

Try removing the .next folder, and updating the packages.

ThamsanQue commented 1 year ago

Ive changed the connection type in db ...from createConnection to createPool and im no longer getting that error ...but now getting this one Cannot read properties of undefined (reading 'findFirst')

Fixed the above error by specifying mode

export const db = drizzle(connection, { schema, mode: 'default' })

When using mysql2 driver with regular MySQL database - you should specify mode: "default".

https://orm.drizzle.team/docs/rqb#modes

ThamsanQue commented 1 year ago

Also noticed that when i click an page for the first time it doesnt go there ..it hits me with this error: error TypeError [ERR_INVALID_STATE]: Invalid state: ReadableStream is already closed What could be causing this?