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

feat: implement service environments + durable objects #868

Merged
merged 1 commit into from
May 2, 2022

Conversation

threepointone
Copy link
Contributor

Now that the APIs for getting migrations tags of services works as expected, this lands support for publishing durable objects to service environments, including migrations. It also removes the error we used to throw when attempting to use service envs + durable objects.

Fixes #739

@changeset-bot
Copy link

changeset-bot bot commented Apr 30, 2022

🦋 Changeset detected

Latest commit: ac9eed5

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

This PR includes changesets to release 1 package
Name Type
wrangler 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

@github-actions
Copy link
Contributor

github-actions bot commented Apr 30, 2022

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/2259310388/npm-package-wrangler-868

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.developers.workers.dev/prs/868/npm-package-wrangler-868

Or you can use npx with this latest build directly:

npx https://prerelease-registry.developers.workers.dev/runs/2259310388/npm-package-wrangler-868 dev path/to/script.js

@threepointone threepointone force-pushed the durable-service-envs branch 2 times, most recently from d1e3f43 to a65e778 Compare April 30, 2022 12:34
const foundIndex = config.migrations.findIndex(
(migration) => migration.tag === script.migration_tag
(migration) => migration.tag === scriptMigrationTag
Copy link
Contributor Author

@threepointone threepointone Apr 30, 2022

Choose a reason for hiding this comment

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

I had to do this because typescript was being weird and saying script could be undefined here (but not saying so for any further occurrence of script.migration_tag 🤷‍♂️)

@threepointone threepointone force-pushed the durable-service-envs branch from a65e778 to 527b067 Compare May 1, 2022 08:25
Copy link
Contributor

@caass caass left a comment

Choose a reason for hiding this comment

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

Looks pretty good to me, just had the one question about how this works when somebody publishes a durable object, switches to service environments, and then publishes a durable object migration.

packages/wrangler/src/publish.ts Outdated Show resolved Hide resolved
}
} catch (err) {
if (
[10090, 10092].includes((err as { code: number }).code) === false
Copy link
Contributor

Choose a reason for hiding this comment

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

i feel like this should just be ![10090, 10092].includes((err as { code: number }).code), right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we also add comments for what these error numbers mean

Copy link
Contributor Author

Choose a reason for hiding this comment

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

heh I'd originally had it in that form, happy to revert to it. I'll add comments for the codes.

@threepointone threepointone force-pushed the durable-service-envs branch from 527b067 to 6589b09 Compare May 2, 2022 17:07
@threepointone threepointone requested a review from caass May 2, 2022 17:11
Now that the APIs for getting migrations tags of services works as expected, this lands support for publishing durable objects to service environments, including migrations. It also removes the error we used to throw when attempting to use service envs + durable objects.

Fixes #739
@threepointone threepointone force-pushed the durable-service-envs branch from 6589b09 to ac9eed5 Compare May 2, 2022 17:12
@threepointone threepointone merged commit 6ecb1c1 into main May 2, 2022
@threepointone threepointone deleted the durable-service-envs branch May 2, 2022 17:43
@github-actions github-actions bot mentioned this pull request May 2, 2022
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.

feat: Implement durable objects + service environments
2 participants