Skip to content

Next 15 does not work if there is an instrumentation.ts file #115

@DevAtHeart

Description

@DevAtHeart

Verify Next.js canary release

  • I verified that the issue exists in the latest Next.js canary release

Describe the bug

The server crashes on startup while trying to compile the instrumentation.ts file.

○ Compiling /instrumentation ...
 ⨯ ./instrumentation.ts
Error:   × failed to invoke plugin on 'Some("/project/workspace/instrumentation.ts")'
[Error: An error occurred while loading instrumentation hook: Cannot find module '/project/workspace/.next/server/instrumentation'
Require stack:
- /project/workspace/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/server/dev/next-dev-server.js
- /project/workspace/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/server/next.js
- /project/workspace/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/server/lib/start-server.js] {
  code: 'MODULE_NOT_FOUND',
  requireStack: [Array]

Expected behavior

The server to startup normally and the superjson plugin to function.

Reproduction link

https://codesandbox.io/p/devbox/festive-marco-874kzf?workspaceId=ws_UDh5PPYTfH5dS4grc4QC5V

Version

0.6.3

Config

{
  reactStrictMode: true,
  experimental: {
    swcPlugins: [["next-superjson-plugin", {}]],
  },
}

Additional context

If you delete the instrumentation.ts file OR the superjson plugin line from next config, everything works normally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions