Can't use Knex in instrumentation hook #65863
Labels
bug
Issue was opened via the bug report template.
Instrumentation
Related to Next.js Instrumentation.
Pages Router
Related to Pages Router.
Runtime
Related to Node.js or Edge Runtime with Next.js.
SWC
Related to minification/transpilation in Next.js.
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/ecstatic-black-2cz5ks
To Reproduce
Current vs. Expected behavior
I expect it to work, instead I run into an import error
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.5.0: Wed May 1 20:19:05 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T8112 Available memory (MB): 24576 Available CPU cores: 8 Binaries: Node: 18.19.0 npm: 10.2.3 Yarn: N/A pnpm: 8.15.1 Relevant Packages: next: 14.2.3 // Latest available version is detected (14.2.3). eslint-config-next: 14.1.1 react: 18.2.0 react-dom: 18.2.0 typescript: 5.4.5 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Instrumentation, Pages Router, Runtime, SWC
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local)
Additional context
This is the same issue as #52091
However, the difference is that I'm using Pages router with instrumentation. The issue I linked above suggests to use
serverComponentsExternalPackages
. However, this turns on App Router features that has consequences that cause errors.According to the Next docs, there's an option serverExternalPackages. However, it seems this option is no longer in the config? There's no intellisense for it and manually putting it in the config causes an error.
I've done this setup before in an earlier version of Next and downgrading isn't a possibility for me right now.
The text was updated successfully, but these errors were encountered: