Description
Link to the code that reproduces this issue
https://github.com/moshie/nextjs-issue
To Reproduce
- Pull down the repo: https://github.com/moshie/nextjs-issue
- run
npm install
- run
npm run build
- See in the .next/standalone/node_modules folder that the
@splunk/otel
prebuilds folder is not included
Current vs. Expected behavior
When using the @splunk/otel
package in the instrumentation file the standalone output doesn't include the prebuilds from: node_modules/@splunk/otel/prebuilds/linux-x64/@splunk+otel.abi115.node
That results in this error:
Since outputFileTracingIncludes
seems like it's tied to the pages and app directories I am not sure how best to include this file into my build?
I've tried in my docker file to include something similar to this:
COPY --chown=nonroot --from=builder /opt/application/node_modules/@splunk ./node_modules/@splunk
COPY --chown=nonroot --from=builder /opt/application/node_modules/.pnpm/@[email protected]_@[email protected] ./node_modules/.pnpm/@[email protected]_@[email protected]
But this isn't a very elegant solution since the path names contain versions and this would need to be updated everytime we update the @splunk/otel package.
I suppose this might have solved my issue but it's been removed (I don't know if it copied whole folders?):
unstable_includeFiles: ['node_modules/@splunk/otel'],
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000
Available memory (MB): 32768
Available CPU cores: 10
Binaries:
Node: 20.16.0
npm: 10.8.1
Yarn: 1.22.22
pnpm: 9.7.0
Relevant Packages:
next: 14.2.5
eslint-config-next: N/A
react: 18.3.1
react-dom: 18.3.1
typescript: 5.5.4
Next.js Config:
output: standalone
Which area(s) are affected? (Select all that apply)
Instrumentation, Output (export/standalone)
Which stage(s) are affected? (Select all that apply)
next build (local), next start (local)
Additional context
My app is dockerised and is using distoless. I thought about just running pnpm install @splunk/otel
directly in the standalone folder but that didn't seem like it would work with distroless and also it's not very elegant either.