You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What problem are we solving and why? (This section copied from @irvinebroque)
Next.js has SSG (static-site generation) where it takes a route and at build time renders the page to generate the static content, that is then uploaded as part of the app.
This works fine with dynamic routes, but doesn't work with static routes (SSG) (Example SSG route)
Why?
Because when you run the Next.js build step (via @opennextjs/cloudflare) — this is using getPlatformProxy() behind the scenes to provide access to bindings
getPlatformProxy() only supports local dev bindings provided by Miniflare — it does not support --remote
This means that if you have a D1 DB you have created, where your data lives and is stored, you can't access it at build time
Create a new Workers application and connect it to the GitHub repository.
Push changes or trigger a rebuild, and it should fail as previously indicated, displaying an error that states it could not find the database table, despite its existence in your account.
Expected behavior
Workers Assets should be able to access bindings at build time
@opennextjs/cloudflare version
0.3.2
Wrangler version
3.99.0
next info output
Operating System:
Platform: win32
Arch: x64
Version: Windows 11 Pro
Available memory (MB): 32206
Available CPU cores: 22
Binaries:
Node: 20.16.0
npm: N/A
Yarn: N/A
pnpm: N/A
Relevant Packages:
next: 14.2.5 // An outdated version detected (latest is 15.1.4), upgrade is highly recommended!
eslint-config-next: 14.2.5
react: 18.3.1
react-dom: 18.3.1
typescript: 5.7.2
Next.js Config:
output: N/A
⚠ An outdated version detected (latest is 15.1.4), upgrade is highly 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
The text was updated successfully, but these errors were encountered:
vicb
changed the title
[BUG] Unable to build SSG application on Cloudflare when a binding is introduced.
[Feature] Access remote bindings while building the app
Jan 15, 2025
Describe the bug
What problem are we solving and why? (This section copied from @irvinebroque)
For Cloudflare Internal Employees:
Steps to reproduce
Steps to Reproduce:
I have a sample repo https://github.com/thomas-desmond/empty-hall-5379 that can be forked but you will need to create your database, see step 2.
Generate a new Next.js application
npm create cloudflare@latest my-next-app – --framework=next --experimental
(See https://developers.cloudflare.com/workers/frameworks/framework-guides/nextjs/)Follow the walkthrough to add a D1 database and make a call to that database in your Next.js application. https://developers.cloudflare.com/d1/get-started/ Here is the call I made in my Next.js application page.tsx https://github.com/thomas-desmond/empty-hall-5379/blob/main/src/app/page.tsx
Push the repository to GitHub
Create a new Workers application and connect it to the GitHub repository.
Push changes or trigger a rebuild, and it should fail as previously indicated, displaying an error that states it could not find the database table, despite its existence in your account.
Expected behavior
Workers Assets should be able to access bindings at build time
@opennextjs/cloudflare version
0.3.2
Wrangler version
3.99.0
next info output
Additional context
No response
The text was updated successfully, but these errors were encountered: