-
Notifications
You must be signed in to change notification settings - Fork 753
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
fix: publish environment specific routes #517
Conversation
This adds some tests for publishing routes, and fixes a couple of bugs with the flow. - fixes publishing environment specific routes, closes #513 - default workers_dev to false if there are any routes specified - catches a hanging promise when we were toggling off a workers.dev subdomain (which should have been caught by the no-floating-promises lint rule, so that's concerning) - this also fixes publishing environment specific crons, but I'll write tests for that when I'm doing that feature in depth I expect to send some followup PRs for routes, but this should make it a little more stable right now
🦋 Changeset detectedLatest commit: b0190d0 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 |
@@ -290,7 +293,7 @@ export default async function publish(props: Props): Promise<void> { | |||
} | |||
} else { | |||
// Disable the workers.dev deployment | |||
fetchResult(`${workerUrl}/subdomain`, { | |||
await fetchResult(`${workerUrl}/subdomain`, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should have been caught by no-floating-promises
🤨
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.developers.workers.dev/runs/1882931742/npm-package-wrangler-517 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.developers.workers.dev/prs/517/npm-package-wrangler-517 Or you can use npx https://prerelease-registry.developers.workers.dev/runs/1882931742/npm-package-wrangler-517 dev path/to/script.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it! Thanks for increasing the test coverage and the clean up.
Should we deprecate the route
config? And just only ever use the routes
field?
@@ -831,7 +831,7 @@ export async function main(argv: string[]): Promise<void> { | |||
(args["compatibility-flags"] as string[]) || | |||
config.compatibility_flags | |||
} | |||
usageModel={config.usage_model} | |||
usageModel={envRootObj.usage_model} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful!
const triggers = props.triggers || envRootObj.triggers?.crons; | ||
const routes = | ||
props.routes || | ||
envRootObj.routes || | ||
(envRootObj.route ? [envRootObj.route] : undefined); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why this was moved above the account_id check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the value of routes
is needed for the default value of deployToWorkersDev
I... don't know tbh. I haven't used it enough to have an opinion. 🤔 |
* Support `durableObjectsPersist` option Uses cloudflare/workerd#302 to enable Durable Object persistence. - `durableObjectsPersist: undefined | false | "memory:"` stores "in-memory" - `durableObjectsPersist: true` stores under `.mf` on the file-system - `durableObjectsPersist: "(file://)?<path>"` stores under `<path>` on the file-system Note Miniflare 2 persisted in-memory data between options reloads. In Miniflare 3, `workerd` restarts on every reload, so if we used `workerd`'s in-memory storage, we'd lose data every time options changed. To maintain Miniflare 2's behaviour, "in-memory" storage isn't actually in-memory. Instead, we write to a temporary directory and clean this up on `dispose()`/exit. 🙈 Also fixes a bug if multiple services bound to the same Durable Object class. This would result in duplicate entries in `durableObjectClassNames`. This has been changed from a `Map` of `string[]`s to a `Map` of `Set<string>`s to enforce the uniqueness constraint. Closes #2403 Closes #2458 Internal ticket: DEVX-219 * fixup! Support `durableObjectsPersist` option * fixup! Support `durableObjectsPersist` option * fixup! Support `durableObjectsPersist` option
* Support `durableObjectsPersist` option Uses cloudflare/workerd#302 to enable Durable Object persistence. - `durableObjectsPersist: undefined | false | "memory:"` stores "in-memory" - `durableObjectsPersist: true` stores under `.mf` on the file-system - `durableObjectsPersist: "(file://)?<path>"` stores under `<path>` on the file-system Note Miniflare 2 persisted in-memory data between options reloads. In Miniflare 3, `workerd` restarts on every reload, so if we used `workerd`'s in-memory storage, we'd lose data every time options changed. To maintain Miniflare 2's behaviour, "in-memory" storage isn't actually in-memory. Instead, we write to a temporary directory and clean this up on `dispose()`/exit. 🙈 Also fixes a bug if multiple services bound to the same Durable Object class. This would result in duplicate entries in `durableObjectClassNames`. This has been changed from a `Map` of `string[]`s to a `Map` of `Set<string>`s to enforce the uniqueness constraint. Closes #2403 Closes #2458 Internal ticket: DEVX-219 * fixup! Support `durableObjectsPersist` option * fixup! Support `durableObjectsPersist` option * fixup! Support `durableObjectsPersist` option
* Support `durableObjectsPersist` option Uses cloudflare/workerd#302 to enable Durable Object persistence. - `durableObjectsPersist: undefined | false | "memory:"` stores "in-memory" - `durableObjectsPersist: true` stores under `.mf` on the file-system - `durableObjectsPersist: "(file://)?<path>"` stores under `<path>` on the file-system Note Miniflare 2 persisted in-memory data between options reloads. In Miniflare 3, `workerd` restarts on every reload, so if we used `workerd`'s in-memory storage, we'd lose data every time options changed. To maintain Miniflare 2's behaviour, "in-memory" storage isn't actually in-memory. Instead, we write to a temporary directory and clean this up on `dispose()`/exit. 🙈 Also fixes a bug if multiple services bound to the same Durable Object class. This would result in duplicate entries in `durableObjectClassNames`. This has been changed from a `Map` of `string[]`s to a `Map` of `Set<string>`s to enforce the uniqueness constraint. Closes #2403 Closes #2458 Internal ticket: DEVX-219 * fixup! Support `durableObjectsPersist` option * fixup! Support `durableObjectsPersist` option * fixup! Support `durableObjectsPersist` option
* Support `durableObjectsPersist` option Uses cloudflare/workerd#302 to enable Durable Object persistence. - `durableObjectsPersist: undefined | false | "memory:"` stores "in-memory" - `durableObjectsPersist: true` stores under `.mf` on the file-system - `durableObjectsPersist: "(file://)?<path>"` stores under `<path>` on the file-system Note Miniflare 2 persisted in-memory data between options reloads. In Miniflare 3, `workerd` restarts on every reload, so if we used `workerd`'s in-memory storage, we'd lose data every time options changed. To maintain Miniflare 2's behaviour, "in-memory" storage isn't actually in-memory. Instead, we write to a temporary directory and clean this up on `dispose()`/exit. 🙈 Also fixes a bug if multiple services bound to the same Durable Object class. This would result in duplicate entries in `durableObjectClassNames`. This has been changed from a `Map` of `string[]`s to a `Map` of `Set<string>`s to enforce the uniqueness constraint. Closes #2403 Closes #2458 Internal ticket: DEVX-219 * fixup! Support `durableObjectsPersist` option * fixup! Support `durableObjectsPersist` option * fixup! Support `durableObjectsPersist` option
This adds some tests for publishing routes, and fixes a couple of bugs with the flow.
workers_dev
tofalse
if there are any routes specifiedworkers.dev
subdomain (which should have been caught by theno-floating-promises
lint rule, so that's concerning)I expect to send some followup PRs for routes, but this should make it a little more stable right now