-
Notifications
You must be signed in to change notification settings - Fork 70
Open
Labels
Description
Describe the bug
If a custom wrangler.jsonc
path is used, bindings are inaccessible during opennextjs-cloudflare build
even if the correct path is specified in the command.
Steps to reproduce
Please see the reproduction here. The error will be present when running bun run deploy
or bun run build
. If you use the default path for the wrangler.jsonc
, then the error goes away.
More details on reproducing the error from scratch:
- Initialize a new OpenNext.js/Cloudflare app, add a binding (e.g. KV namespace), and use the binding on a page (e.g. list KV items). This will work as expected during development, build, and deployment.
- Rename the
wrangler.jsonc
file and update the relevant parameters (e.g.opennextjs-cloudflare build--configPath custom-wrangler.jsonc
,opennextjs-cloudflare deploy--configPath custom-wrangler.jsonc
andinitOpenNextCloudflareForDev({ configPath: "custom-wrangler.jsonc" });
. - Development will still work, but the build command will fail, seemingly because the custom wrangler config path is not honored during builds, so the bindings are undefined. The specific error appears during the SSG phase:
▲ Next.js 15.4.6
Using vars defined in .dev.vars
Using vars defined in .dev.vars
Creating an optimized production build ...
Using vars defined in .dev.vars
Using vars defined in .dev.vars
Using vars defined in .dev.vars
✓ Compiled successfully in 0ms
✓ Linting and checking validity of types
✓ Collecting page data
Using vars defined in .dev.vars
Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of undefined (reading 'list')
at j (.next/server/app/page.js:1:3623)
at async i (.next/server/app/page.js:1:2354) {
digest: '776967440'
}
Export encountered an error on /page: /, exiting the build.
⨯ Next.js build worker exited with code: 1 and signal: null
Expected behavior
SSG should work during opennextjs-cloudflare build
when a custom Wrangler --configPath
is specified.
@opennextjs/cloudflare version
1.7.0
Wrangler version
4.33.2
next info output
Using vars defined in .dev.vars
/bin/sh: yarn: command not found
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:29 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6000
Available memory (MB): 32768
Available CPU cores: 10
Binaries:
Node: 22.15.0
npm: 10.9.2
Yarn: N/A
pnpm: 10.14.0
Relevant Packages:
next: 15.4.6 // There is a newer version (15.5.2) available, upgrade recommended!
eslint-config-next: N/A
react: 19.1.0
react-dom: 19.1.0
typescript: 5.9.2
Next.js Config:
output: N/A
⚠ There is a newer version (15.5.2) available, upgrade recommended!
Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
Read more - https://nextjs.org/docs/messages/opening-an-issue
Additional context
No response