Skip to content

Cannot resolve @sentry/nextjs on Cloudflare Workers #18843

@logaretm

Description

@logaretm

Description

Some users reported errors related to @sentry/nextjs not being resolved correctly in Cloudflare Workers runtime.

✘ [ERROR] Could not resolve "@sentry/nextjs"

    .open-next/server-functions/default/.next/server/app/sentry-example-page/page.js:2:9038:
      2 │ ...ve().then(c.bind(c,70704))},77134:a=>{"use strict";a.exports=require("@sentry/nextjs")},80764:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=...
        ╵                                                                         ~~~~~~~~~~~~~~~~

  The module "./build/cjs/edge/index.js" was not found on the file system:

    .open-next/server-functions/default/node_modules/@sentry/nextjs/package.json:39:19:
      39 │         "require": "./build/cjs/edge/index.js",

Workaround

@dispalt reported that the following workaround fixes it:

const nextConfig = {
  pageExtensions: ['js', 'jsx', 'md', 'mdx', 'ts', 'tsx'],
  outputFileTracingIncludes: {
    "*": ["node_modules/@sentry/nextjs/build/**/*"],
  },
// ...
}

User Reports:


I didn't manage to reproduce this at all, but it could be something with NFT or specific configurations.

Metadata

Metadata

Assignees

Labels

No fields configured for issues without a type.

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions