fix(create-cloudflare): Fix regression in C3's next template#7774
fix(create-cloudflare): Fix regression in C3's next template#7774CarmenPopoviciu merged 3 commits intomainfrom
Conversation
🦋 Changeset detectedLatest commit: bea9a39 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12798470841/npm-package-wrangler-7774You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/7774/npm-package-wrangler-7774Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12798470841/npm-package-wrangler-7774 dev path/to/script.jsAdditional artifacts:cloudflare-workers-bindings-extension: wget https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12798470841/npm-package-cloudflare-workers-bindings-extension-7774 -O ./cloudflare-workers-bindings-extension.0.0.0-v9f74e3def.vsix && code --install-extension ./cloudflare-workers-bindings-extension.0.0.0-v9f74e3def.vsixcreate-cloudflare: npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12798470841/npm-package-create-cloudflare-7774 --no-auto-update@cloudflare/kv-asset-handler: npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12798470841/npm-package-cloudflare-kv-asset-handler-7774miniflare: npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12798470841/npm-package-miniflare-7774@cloudflare/pages-shared: npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12798470841/npm-package-cloudflare-pages-shared-7774@cloudflare/unenv-preset: npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12798470841/npm-package-cloudflare-unenv-preset-7774@cloudflare/vitest-pool-workers: npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12798470841/npm-package-cloudflare-vitest-pool-workers-7774@cloudflare/workers-editor-shared: npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12798470841/npm-package-cloudflare-workers-editor-shared-7774@cloudflare/workers-shared: npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12798470841/npm-package-cloudflare-workers-shared-7774@cloudflare/workflows-shared: npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12798470841/npm-package-cloudflare-workflows-shared-7774Note that these links will no longer work once the GitHub Actions artifact expires.
Please ensure constraints are pinned, and |
50b3f6e to
9cc12d5
Compare
There was a problem hiding this comment.
we should start adding comments when we quarantine tests
There was a problem hiding this comment.
we should also evaluate why tests still need to be quarantined (maybe an investigation + adding respective comments) would be a good start 🙂
There was a problem hiding this comment.
PS: as far as I can tell quarantined tests get forgotten and their templates can completely break without anyone noticing, I wonder if we could increase the visibility of these too
There was a problem hiding this comment.
(that's actually what happened here isn't it? 🤔 next broke but no one noticed right away since it's quarantined)
There was a problem hiding this comment.
that is correct yes. and I agree that we should evaluate what tests are quarantined and why. I took a quick look and both astro and analog tests are quarantined. I have context over the analog ones but not the astro ones
eee742f to
e42878f
Compare
There was a problem hiding this comment.
to keep things consistent with the rest of the comments in the config file, I added the KV comment in a similar format. IMHO, it made no sense to add the extra // KV example line, so I didn't, and modified the readme instead. Lemme know if anyone strongly disagrees
There was a problem hiding this comment.
I don't know if adding the kv_namespaces only for next makes sense... (why KV is the only binding included? what about DOs, R2, etc... why the preferential treatment?) as we discussed maybe we should just get rid of the KV example in the next template instead 🤔
I'm happy to progress with this solution but (maybe as a followup) I think removing the example would be better
There was a problem hiding this comment.
why KV is the only binding included? what about DOs, R2, etc... why the preferential treatment?
I totally get what you mean. But then, wasn't this question equally relevant in the prev version? Why did the nextjs starter ship only with a KV example? I have no context whatsoever as to why/how this decision was taken.
Don't get me wrong, I don't mind removing it, but then my question is, does C3 come with anything similar out of the box?...as in an example or template that exemplify how such bindings are set. Does it need to? Arguably, these are all larger prod questions
There was a problem hiding this comment.
I totally get what you mean. But then, wasn't this question equally relevant in the prev version?
yeah I agree with you, this was basically the same before, the Next.js template being the only framework one having an extra KV example 👍
I'm just bringing it up because before it was less expensive to have this divergence (basically a single extra comment in the shared toml file) while now it seems like it requires us to add the KV declaration comment to all wrangler configs, given this extra downside maybe it's no longer worth it
Why did the nextjs starter ship only with a KV example?
We discussed it on the frameworks team and concluded that it'd be nice to show such an example to make sure that people knew how to access bindings in their Next.js app, that's all
does C3 come with anything similar out of the box?
I'd have to check, I am quite sure the Next.js one is the only fullstack template with this, as for workers I would imagine that they also have extra configs as well
Don't get me wrong, I don't mind removing it
I don't particularly mind if you keep it in, I just personally think that the extra (even if very small) complexity + having the KV for all template configs makes the example not that KV Next.js example worth keeping, but it's also not a big deal 🙂
There was a problem hiding this comment.
while now it seems like it requires us to add the KV declaration comment to all wrangler configs
I am 100% with you on this! And tbh, I do have the same concern as you. On the other hand, I 100% believe that the KV example is valuable for our users, which is why I'm holding on to it with my dear life 😆 . IMHO if it's not meant to live in the starter project it should def live somewhere else...tho the starter is such a great place, because it requires zero context switch on the dev's side
We discussed it on the frameworks team and concluded that it'd be nice to show such an example to make sure that people knew how to access bindings in their Next.js app, that's all
yes 💯 this!!!!
having said all this I feel like there is not enough consensus (wrt what the right fix is) to land this PR just yet. How about if I just revert the next template back to wrangler.toml. The remix template is still using a .toml config file, so it wouldn't be the only exception. Just so we can bump the C3 version with a fix. And in the meanwhile, we can iterate this PR without the pressure of a fix release on our back
There was a problem hiding this comment.
oh wait...we actually can't revert back to wrangler.toml because of how we now standardise comments. NVM me
There was a problem hiding this comment.
Nono, I am totally happy to go with the current solution! we can always re-evaluate later! no big deal 🙂
There was a problem hiding this comment.
Not blocking this PR, but there's also a bunch of other places that use wrangler.toml, I think next is just more commonly use so it's come up here.
I think wrangler.toml is still used in
- hello world + hello world with assets vitest config
- download pre-existing worker from dash
- comment on the worker-configuration.d.ts files
sorry should've caught these while reviewing the original PR!
0575c03 to
92feb25
Compare
|
It's pretty minor and could be done in a followup PR, but if you follow the readme instructions: workers-sdk/packages/create-cloudflare/templates/next/README.md Lines 40 to 64 in 99f27df things don't really work well as a comma is missing in the People should not get too confused by this but to fix it we should add a comma here (I think?): (or just mention in the readme to add the comma?) |
This comment was marked as off-topic.
This comment was marked as off-topic.
dario-piotrowicz
left a comment
There was a problem hiding this comment.
Looks good to me, thanks @CarmenPopoviciu 😄
92feb25 to
76200e9
Compare
76200e9 to
ac0b555
Compare
|
just for posterity...
|
andyjessop
left a comment
There was a problem hiding this comment.
Really nice investigation and PR. Thanks so much for this 🚀

#7676 switched C3 templates to default to
wrangler.jsoninstead ofwrangler.toml. Unfortunately, this unintendedly broke thenexttemplate, which was still attempting to readwrangler.tomlspecifically.This commit fixes the regression.
Fixes #7770
These changes were also tested using a test project and the C3 pre-release url . See snapshot of generated readme file 👇