Skip to content

Conversation

conico974
Copy link
Collaborator

A quick fix for initOpenNextCloudflareForDev while waiting for a better solution in wrangler itself.
Fix #502

Copy link

changeset-bot bot commented Mar 27, 2025

⚠️ No Changeset found

Latest commit: ffcbb85

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

pkg-pr-new bot commented Mar 27, 2025

Open in Stackblitz

pnpm add https://pkg.pr.new/@opennextjs/cloudflare@507

commit: ffcbb85

async function patchWranglerConfig() {
//First thing here, we try to load the `wrangler.jsonc` file
let existingWranglerConfig: Record<string, unknown> | null = null;
const originalWranglerConfigPath = `${process.cwd()}/wrangler.jsonc`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But:

  • this does not support toml and json extensions
  • this does not support custom config paths

I think the best workaround for now would be to set script_name to the worker name. It is not ideal either as wrangler then shows a misleading warning :(

ref: cloudflare/workers-sdk#8687

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it was more just a quick patch to test a fix for some cases and to get feedback (that's why it's a draft)

The big issue with the script_name is that in preview if you use one of the DO, it fails.
I think the good quick fix is in the workers-sdk to have an option to ignore DO for getPlatformProxy, we don't need more than that, just that it doesn't crash at build time.

@conico974
Copy link
Collaborator Author

I'm gonna close this then, hopefully we'll get a fix pretty soon for cloudflare/workers-sdk#8687

@conico974 conico974 closed this Mar 27, 2025
@vicb vicb deleted the fix/init-dev branch June 23, 2025 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Build Fails Due to Missing Durable Object Classes in Worker Configuration

2 participants