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

[BUG]: @planetscale/database should not be imported in drizzle-orm/planetscale-serverless/session.js #311

Closed
PietervdWerk opened this issue Mar 25, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@PietervdWerk
Copy link

What version of drizzle-orm are you using?

0.22.0

Describe the Bug

I'm experiencing a weird issue related to imports when using drizzle-orm/planetscale-serverless.

Error when evaluating SSR module /src/db/index.ts: failed to import "drizzle-orm/planetscale-serverless"

[vite] Error when evaluating SSR module /Users/my-user-account/Documents/projects/my-project-name/src/pages/api/auth/[...auth].ts:

 error   require() of ES Module /Users/my-user-account/Documents/projects/my-project-name/node_modules/@planetscale/database/dist/index.js from /Users/my-user-account/Documents/projects/my-project-name/node_modules/drizzle-orm/planetscale-serverless/session.js not supported.
  Instead change the require of index.js in /Users/my-user-account/Documents/projects/my-project-name/node_modules/drizzle-orm/planetscale-serverless/session.js to a dynamic import() which is available in all CommonJS modules.

I've researched this issue and found that only the types are used (which is good), but in the build session.js file a require("@planetscale/database"); is found. Removing that line actually resolves the issue entirely. I'm unsure how this issue is created, but I hope there are some smart tsconfig people here to resolve it.

@PietervdWerk PietervdWerk added the bug Something isn't working label Mar 25, 2023
@barthicus
Copy link
Contributor

@PietervdWerk have you tried using drizzle-orm@beta?

@PietervdWerk
Copy link
Author

@PietervdWerk have you tried using drizzle-orm@beta?

I now have per your suggestion, and this indeed solves it. Thanks!

@barthicus
Copy link
Contributor

@PietervdWerk Glad it worked ✌️ I suggested trying the latest beta version because your issue sounded similar to other issues like this: #284

@PietervdWerk
Copy link
Author

@PietervdWerk Glad it worked ✌️ I suggested trying the latest beta version because your issue sounded similar to other issues like this: #284

Yes you're totally right, I didn't see that one. I'll close this issue :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants