Skip to content
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

🐛 BUG: [c3] new projects are almost always scaffolded with incorrect compatibility dates, resulting in noisy warnings #2385

Closed
IgorMinar opened this issue Dec 10, 2022 · 3 comments · Fixed by #3343 or #3503
Assignees
Labels
bug Something that isn't working c3 Relating to C3 (create-cloudflare) package

Comments

@IgorMinar
Copy link
Contributor

What version of Wrangler are you using?

2.6.2

What operating system are you using?

Mac

Describe the Bug

In a brand new project I get the following warning:

 wrangler dev --experimental-local                                                                     
 ⛅️ wrangler 2.6.2 
-------------------
[mf:wrn] The latest compatibility date supported by the installed Cloudflare Workers Runtime is "2022-11-11",
but you've requested "2022-12-10". Falling back to "2022-11-11"...

While this warning is non-fatal, it adds to noise that is visible each time a wrangler dev command runs. Could we avoid scaffolding projects with wrong compat date in some way?

For example we could try to fetch the latest compat date when scaffolding new project, and fall back to a version hardcoded into wrangler (which we would need to bump when new compat dates are available).

@IgorMinar IgorMinar added the bug Something that isn't working label Dec 10, 2022
@workers-devprod workers-devprod moved this to Untriaged in workers-sdk Dec 10, 2022
@IgorMinar IgorMinar changed the title 🐛 BUG: 🐛 BUG: new projects are almost always scaffolded with incorrect compatibility dates, resulting in noisy warnings Dec 10, 2022
@rozenmd
Copy link
Contributor

rozenmd commented Dec 12, 2022

@mrbbot do you know why using the current date stopped working?

@mrbbot
Copy link
Contributor

mrbbot commented Dec 12, 2022

Yep! The issue here is that workerd only supports compatibility dates up to the date it was built. If a new compatibility flag was added, this wouldn't be supported in old already-distributed workerd binaries.

Once we have --experimental-local as the default (which would presumably mean installing workerd with every wrangler install), we can do import { compatibilityDate } from "workerd" as use that when initing projects.

For now, we could try fetch the latest workerd version number from npm (which embeds the compatibility date in the minor), or just hardcode a version into wrangler?

@penalosa
Copy link
Contributor

In Wrangler v3, project creation is handled by create-cloudflare

@penalosa penalosa added c3 Relating to C3 (create-cloudflare) package and removed miniflare Relating to Miniflare labels May 19, 2023
@penalosa penalosa changed the title 🐛 BUG: new projects are almost always scaffolded with incorrect compatibility dates, resulting in noisy warnings 🐛 BUG: [c3] new projects are almost always scaffolded with incorrect compatibility dates, resulting in noisy warnings May 19, 2023
petebacondarwin added a commit to petebacondarwin/wrangler2 that referenced this issue May 25, 2023
Previously, we changed wrangler.toml to use the current date for the
compatibility_date setting in wrangler.toml when generating workers.
But this is almost always going to be new recent and results in a warning.

Now we look up the most recent compatibility date via npm on the workerd
package and use that instead.

Fixes cloudflare#2385
petebacondarwin added a commit to petebacondarwin/wrangler2 that referenced this issue May 25, 2023
Previously, we changed wrangler.toml to use the current date for the
compatibility_date setting in wrangler.toml when generating workers.
But this is almost always going to be new recent and results in a warning.

Now we look up the most recent compatibility date via npm on the workerd
package and use that instead.

Fixes cloudflare#2385
petebacondarwin added a commit to petebacondarwin/wrangler2 that referenced this issue May 26, 2023
Previously, we changed wrangler.toml to use the current date for the
compatibility_date setting in wrangler.toml when generating workers.
But this is almost always going to be new recent and results in a warning.

Now we look up the most recent compatibility date via npm on the workerd
package and use that instead.

Fixes cloudflare#2385
petebacondarwin added a commit to petebacondarwin/wrangler2 that referenced this issue May 26, 2023
Previously, we changed wrangler.toml to use the current date for the
compatibility_date setting in wrangler.toml when generating workers.
But this is almost always going to be new recent and results in a warning.

Now we look up the most recent compatibility date via npm on the workerd
package and use that instead.

Fixes cloudflare#2385
@petebacondarwin petebacondarwin moved this from Backlog to In Review in workers-sdk May 26, 2023
petebacondarwin added a commit to petebacondarwin/wrangler2 that referenced this issue May 26, 2023
Previously, we changed wrangler.toml to use the current date for the
compatibility_date setting in wrangler.toml when generating workers.
But this is almost always going to be new recent and results in a warning.

Now we look up the most recent compatibility date via npm on the workerd
package and use that instead.

Fixes cloudflare#2385
petebacondarwin added a commit to petebacondarwin/wrangler2 that referenced this issue May 26, 2023
Previously, we changed wrangler.toml to use the current date for the
compatibility_date setting in wrangler.toml when generating workers.
But this is almost always going to be new recent and results in a warning.

Now we look up the most recent compatibility date via npm on the workerd
package and use that instead.

Fixes cloudflare#2385
petebacondarwin added a commit to petebacondarwin/wrangler2 that referenced this issue May 26, 2023
Previously, we changed wrangler.toml to use the current date for the
compatibility_date setting in wrangler.toml when generating workers.
But this is almost always going to be new recent and results in a warning.

Now we look up the most recent compatibility date via npm on the workerd
package and use that instead.

Fixes cloudflare#2385
petebacondarwin added a commit to petebacondarwin/wrangler2 that referenced this issue May 27, 2023
Previously, we changed wrangler.toml to use the current date for the
compatibility_date setting in wrangler.toml when generating workers.
But this is almost always going to be new recent and results in a warning.

Now we look up the most recent compatibility date via npm on the workerd
package and use that instead.

Fixes cloudflare#2385
petebacondarwin added a commit to petebacondarwin/wrangler2 that referenced this issue May 27, 2023
Previously, we changed wrangler.toml to use the current date for the
compatibility_date setting in wrangler.toml when generating workers.
But this is almost always going to be new recent and results in a warning.

Now we look up the most recent compatibility date via npm on the workerd
package and use that instead.

Fixes cloudflare#2385
petebacondarwin added a commit to petebacondarwin/wrangler2 that referenced this issue May 27, 2023
Previously, we changed wrangler.toml to use the current date for the
compatibility_date setting in wrangler.toml when generating workers.
But this is almost always going to be new recent and results in a warning.

Now we look up the most recent compatibility date via npm on the workerd
package and use that instead.

Fixes cloudflare#2385
petebacondarwin added a commit to petebacondarwin/wrangler2 that referenced this issue May 27, 2023
Previously, we changed wrangler.toml to use the current date for the
compatibility_date setting in wrangler.toml when generating workers.
But this is almost always going to be new recent and results in a warning.

Now we look up the most recent compatibility date via npm on the workerd
package and use that instead.

Fixes cloudflare#2385
petebacondarwin added a commit to petebacondarwin/wrangler2 that referenced this issue May 27, 2023
Previously, we changed wrangler.toml to use the current date for the
compatibility_date setting in wrangler.toml when generating workers.
But this is almost always going to be new recent and results in a warning.

Now we look up the most recent compatibility date via npm on the workerd
package and use that instead.

Fixes cloudflare#2385
@lrapoport-cf lrapoport-cf added the v3 label Jun 5, 2023
petebacondarwin added a commit to petebacondarwin/wrangler2 that referenced this issue Jun 20, 2023
Previously, we changed wrangler.toml to use the current date for the
compatibility_date setting in wrangler.toml when generating workers.
But this is almost always going to be new recent and results in a warning.

Now we look up the most recent compatibility date via npm on the workerd
package and use that instead.

Fixes cloudflare#2385
petebacondarwin added a commit to petebacondarwin/wrangler2 that referenced this issue Jun 20, 2023
Previously, we changed wrangler.toml to use the current date for the
compatibility_date setting in wrangler.toml when generating workers.
But this is almost always going to be new recent and results in a warning.

Now we look up the most recent compatibility date via npm on the workerd
package and use that instead.

Fixes cloudflare#2385
petebacondarwin added a commit to petebacondarwin/wrangler2 that referenced this issue Jun 20, 2023
Previously, we changed wrangler.toml to use the current date for the
compatibility_date setting in wrangler.toml when generating workers.
But this is almost always going to be new recent and results in a warning.

Now we look up the most recent compatibility date via npm on the workerd
package and use that instead.

Fixes cloudflare#2385
petebacondarwin added a commit to petebacondarwin/wrangler2 that referenced this issue Jun 23, 2023
Previously, we changed wrangler.toml to use the current date for the
compatibility_date setting in wrangler.toml when generating workers.
But this is almost always going to be new recent and results in a warning.

Now we look up the most recent compatibility date via npm on the workerd
package and use that instead.

Fixes cloudflare#2385
petebacondarwin added a commit that referenced this issue Jun 23, 2023
* [C3] fix: use a valid compatibility date for worker templates

Previously, we changed wrangler.toml to use the current date for the
compatibility_date setting in wrangler.toml when generating workers.
But this is almost always going to be new recent and results in a warning.

Now we look up the most recent compatibility date via npm on the workerd
package and use that instead.

Fixes #2385

* Improve workerd date matching and support non-npm runners.

* fixup! [C3] fix: use a valid compatibility date for worker templates
@github-project-automation github-project-automation bot moved this from In Review to Done in workers-sdk Jun 23, 2023
lrapoport-cf pushed a commit that referenced this issue Aug 11, 2023
* [C3] fix: use a valid compatibility date for worker templates

Previously, we changed wrangler.toml to use the current date for the
compatibility_date setting in wrangler.toml when generating workers.
But this is almost always going to be new recent and results in a warning.

Now we look up the most recent compatibility date via npm on the workerd
package and use that instead.

Fixes #2385

* Improve workerd date matching and support non-npm runners.

* fixup! [C3] fix: use a valid compatibility date for worker templates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working c3 Relating to C3 (create-cloudflare) package
Projects
None yet
8 participants