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 using Next.js turbo #1257

Closed
4 of 20 tasks
ariperez opened this issue May 28, 2023 · 10 comments
Closed
4 of 20 tasks

Error when using Next.js turbo #1257

ariperez opened this issue May 28, 2023 · 10 comments
Assignees
Labels

Comments

@ariperez
Copy link

Package + Version

  • @clerk/clerk-js
  • @clerk/clerk-react
  • @clerk/nextjs
  • @clerk/remix
  • @clerk/types
  • @clerk/themes
  • @clerk/localizations
  • @clerk/clerk-expo
  • @clerk/backend
  • @clerk/clerk-sdk-node
  • @clerk/shared
  • @clerk/fastify
  • @clerk/chrome-extension
  • gatsby-plugin-clerk
  • build/tooling/chore
  • other:

Dependencies + versions

Provide a json with the dependencies used in your project (copy paste from yarn.lock / package-lock.json) or a github project / template that reproduces the issue.

Include the @clerk/ packages and their versions!*

Example:

{  
  "dependencies": {
    "next": "13.4.4",
  },
  "devDependencies": {
    "@clerk/clerk-sdk-node": "^4.10.2",
    "@clerk/nextjs": "^4.19.0",
  },
  "peerDependencies": {
    "react": "18.2.0"
  }
}

Description

when attempting to run the latest version of Next.js with Turbopack enabled, the following error originates from @clerk/nextjs.

npm run dev --turbo
error during Next.js routing for /

Caused by:
- Error: Cannot find module '#crypto'

Debug info:
- Execution of get_from_source failed
- Execution of resolve_source_request failed
- Execution of NextRouterContentSource::get failed
- error during Next.js routing for /
- Error: Cannot find module '#crypto'
      [at file:///Users/ariperez/github/coa-solutions/app/.next/build/edge/chunks/[next]_entry_edge-bootstrap.ts_00208c._.js]
      [at file:///Users/ariperez/github/coa-solutions/app/.next/build/edge/chunks/node_modules_0367fb._.js:13896:15]
      [at file:///Users/ariperez/github/coa-solutions/app/.next/build/edge/chunks/node_modules_0367fb._.js:13899:3]
      [at [project]/node_modules/@clerk/backend/dist/esm/index.js (ecmascript) (file:///Users/ariperez/github/coa-solutions/app/.next/build/edge/chunks/node_modules_0367fb._.js:15738:3)]
      [at file:///Users/ariperez/github/coa-solutions/app/.next/build/edge/chunks/[next]_entry_edge-bootstrap.ts_00208c._.js:497:21]
      [at runModuleExecutionHooks (file:///Users/ariperez/github/coa-solutions/app/.next/build/edge/chunks/[next]_entry_edge-bootstrap.ts_00208c._.js:544:5)]
      [at instantiateModule (file:///Users/ariperez/github/coa-solutions/app/.next/build/edge/chunks/[next]_entry_edge-bootstrap.ts_00208c._.js:496:5)]
      [at getOrInstantiateModuleFromParent (file:///Users/ariperez/github/coa-solutions/app/.next/build/edge/chunks/[next]_entry_edge-bootstrap.ts_00208c._.js:593:10)]
      [at esmImport (file:///Users/ariperez/github/coa-solutions/app/.next/build/edge/chunks/[next]_entry_edge-bootstrap.ts_00208c._.js:217:18)]
      [at file:///Users/ariperez/github/coa-solutions/app/.next/build/edge/chunks/node_modules_0367fb._.js:16316:142]
      [at [project]/node_modules/@clerk/nextjs/dist/esm/server/getAuth.js (ecmascript) (file:///Users/ariperez/github/coa-solutions/app/.next/build/edge/chunks/node_modules_0367fb._.js:16405:3)]
@doneumark
Copy link

Experiencing the same problem!

@nikosdouvlis
Copy link
Member

Hello everyone, we're currently working with the NextJS team to get all Turbopack-related issues solved. I don't currently have a strict timeline I can share as this an upstream dependency, but I'll probably have more updates towards the end of this week.

Related issues on the NextJS repo:

@muradbu
Copy link

muradbu commented Jun 15, 2023

I'm running into the same issue although I have a slightly different error message:

error during Next.js routing for /

Caused by:
- Error: Cannot find module '#components'

Debug info:
- Execution of get_from_source failed
- Execution of resolve_source_request failed
- Execution of NextRouterContentSource::get failed
- error during Next.js routing for /
- Error: Cannot find module '#components'
      [at file:///Users/murad/Developer/whounfollowed.me/.next/build/edge/chunks/[next]_entry_edge-bootstrap.ts_209802._.js]
      [at file:///Users/murad/Developer/whounfollowed.me/.next/build/edge/chunks/a90cf_@clerk_nextjs_dist_esm_index_94092a.js:196:15]
      [at file:///Users/murad/Developer/whounfollowed.me/.next/build/edge/chunks/a90cf_@clerk_nextjs_dist_esm_index_94092a.js:199:3]
      [at [project]/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@clerk/nextjs/dist/esm/index.js (ecmascript) (file:///Users/murad/Developer/whounfollowed.me/.next/build/edge/chunks/a90cf_@clerk_nextjs_dist_esm_index_94092a.js:223:3)]
      [at file:///Users/murad/Developer/whounfollowed.me/.next/build/edge/chunks/[next]_entry_edge-bootstrap.ts_209802._.js:497:21]
      [at runModuleExecutionHooks (file:///Users/murad/Developer/whounfollowed.me/.next/build/edge/chunks/[next]_entry_edge-bootstrap.ts_209802._.js:544:5)]
      [at instantiateModule (file:///Users/murad/Developer/whounfollowed.me/.next/build/edge/chunks/[next]_entry_edge-bootstrap.ts_209802._.js:496:5)]
      [at getOrInstantiateModuleFromParent (file:///Users/murad/Developer/whounfollowed.me/.next/build/edge/chunks/[next]_entry_edge-bootstrap.ts_209802._.js:593:10)]
      [at esmImport (file:///Users/murad/Developer/whounfollowed.me/.next/build/edge/chunks/[next]_entry_edge-bootstrap.ts_209802._.js:217:18)]
      [at file:///Users/murad/Developer/whounfollowed.me/.next/build/edge/chunks/src_middleware.ts_d079f0._.js:9:276]
      [at [project]/src/middleware.ts (ecmascript, ecmascript) (file:///Users/murad/Developer/whounfollowed.me/.next/build/edge/chunks/src_middleware.ts_d079f0._.js:21:3)]

@YahiaElTai
Copy link

Experiencing the same issue as well.

@clerk-cookie
Copy link
Collaborator

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@dimkl dimkl removed the Stale label Jul 31, 2023
@clerk-cookie
Copy link
Collaborator

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@clerk-cookie
Copy link
Collaborator

This issue was closed because it has been stalled for 10 days with no activity.

@clerk-cookie clerk-cookie closed this as not planned Won't fix, can't repro, duplicate, stale Sep 9, 2023
@obabovic
Copy link

Any update on this matter? I'm using turborepo + NestJS + Jest. When trying to import a module that references any of Clerk entities inside .spec (Jest) files, I get to the same error - cannot find module #crypto. Went into node_modules/.pnpm/@[email protected]/node_modules/@clerk/backend/dist/index.js, I can see:

...
var import_crypto = __toESM(require("#crypto"));
var fetchApisPolyfill = __toESM(require("#fetch"));

Both of these can't actually be found.

What to do here?

@dimkl
Copy link
Contributor

dimkl commented Oct 19, 2023

Hello @obabovic ,
the issue with Jest may be related to the fact that Jest currently doesn't support package.json subpath imports, so you will have to manually add the following to your Jest file:

moduleNameMapper: { '#crypto': '@clerk/backend/dist/runtime/node/crypto.js', '#fetch': '@clerk/backend/dist/runtime/node/fetch.js', },

Could you try this?

@clerk-cookie
Copy link
Collaborator

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@clerk clerk locked as resolved and limited conversation to collaborators Oct 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

8 participants