Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Upload "draft" worker if secret is created before initial worker script has been uploaded #1087

Merged
merged 8 commits into from
Feb 19, 2020

Conversation

gabbifish
Copy link
Contributor

This PR closes #913.

It introduces fallback logic to upload a "draft" worker whenever a secrets API call is made for a specific script name, and a worker for the script name does not exist yet. This fallback logic currently applies to secret upload and deletion; we can also extend it to wrangler secret list if we'd like. I currently avoid doing that given that one is extremely unlikely to use wrangler secret list before calling wrangler secret put/delete, but then again, it could be worth preventing unexpected behavior for this CLI call as well.

@gabbifish gabbifish added feature Feature requests and suggestions status - needs review regression Something is broken, but works in previous releases labels Feb 19, 2020
@ashleymichal
Copy link
Contributor

ashleymichal commented Feb 19, 2020

This fallback logic currently applies to secret upload and deletion;

if the script doesn't exist, then no secret could exist to delete; i think this logic only makes sense for put, and the error should be handled with a message::warn on list and delete.

Copy link
Contributor

@ashleymichal ashleymichal left a comment

Choose a reason for hiding this comment

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

it only makes sense to create a script on put, not delete.

src/commands/secret/mod.rs Show resolved Hide resolved
src/commands/secret/mod.rs Outdated Show resolved Hide resolved
@gabbifish gabbifish changed the title Gabbi/fix #913 Upload "draft" worker if secret is created before initial worker script has been uploaded Feb 19, 2020
src/commands/secret/mod.rs Outdated Show resolved Hide resolved
src/commands/secret/mod.rs Show resolved Hide resolved
@gabbifish gabbifish merged commit 93456d8 into master Feb 19, 2020
@gabbifish gabbifish deleted the gabbi/fix-#913 branch February 19, 2020 19:20
@EverlastingBugstopper EverlastingBugstopper added this to the 1.8.0-rc.2 milestone Feb 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature Feature requests and suggestions regression Something is broken, but works in previous releases
Projects
None yet
3 participants