Skip to content

fix cache population hanging #648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 7, 2025
Merged

Conversation

conico974
Copy link
Collaborator

Should fix #647

Copy link

changeset-bot bot commented May 7, 2025

🦋 Changeset detected

Latest commit: 12b30cd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@opennextjs/cloudflare Patch

Not sure what this means? Click here to learn what changesets are.

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

Copy link

pkg-pr-new bot commented May 7, 2025

Open in StackBlitz

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

commit: 12b30cd

Comment on lines 102 to 104
const proxy = await getPlatformProxy<CloudflareEnv>(populateCacheOptions);
const prefix = proxy.env[R2_CACHE_PREFIX_ENV_NAME]; // Set the cache type to R2 for the current environment
await proxy.dispose();
Copy link
Contributor

Choose a reason for hiding this comment

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

2 nits:

  • Maybe extract this into async getEnvFromPlatformProxy()?
  • Only call it after line 109 (i.e. skip if not needed)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe extract this into async getEnvFromPlatformProxy()

I was thinking actually that we could use the proxy bindings when target is local. I just tested that and it's like a 60 times speed up WDYT ?
Probably in another PR though

Copy link
Contributor

Choose a reason for hiding this comment

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

We can create an issue for now.

I think implementing batch population in wrangler would be better as it could benefit other projects.

Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

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

LGTM with a few nits.

I'm curious about what pointed you into that direction / how confident are you that the PR fixes the issue?

@conico974
Copy link
Collaborator Author

I'm curious about what pointed you into that direction / how confident are you that the PR fixes the issue?

I knew it was probably something related to wrangler process, so it was either the wrangler update or the proxy.
I tested with the proxy fix and the populateCache command does not hang anymore. Don't know how i missed that yesterday, my brain probably just ignored it since there was no error and it was actually populating

Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

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

Added a commit to refine the typing

Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

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

Added a commit to refine the typing

@conico974 conico974 merged commit cb3a2f2 into opennextjs:main May 7, 2025
7 checks passed
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] Deployment hangs after printing version ID and throws Build took too long and was timed out
3 participants