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

allow creation of preview namespace when namespace exists in toml #1414

Merged
merged 2 commits into from Jun 26, 2020

Conversation

EverlastingBugstopper
Copy link
Contributor

when we introduced KV preview namespaces, we made sure to add nice messages when creating new namespaces so people could easily add the new namespace id to their wrangler.toml in the correct place.

However, we missed a very common case where folks already have a production namespace defined in their wrangler.toml and they want to add a preview namespace. When this is the case, we return an error message intended to only be thrown when running either wrangler preview or wrangler dev.

@EverlastingBugstopper EverlastingBugstopper added this to the 1.10.3 milestone Jun 25, 2020
@EverlastingBugstopper EverlastingBugstopper requested a review from a team as a code owner June 25, 2020 18:51
@EverlastingBugstopper EverlastingBugstopper changed the title [wip] allow creation of preview namespace when namespace exists in toml allow creation of preview namespace when namespace exists in toml Jun 26, 2020
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.

looks good but i think we should proactively check for presence of account id in the command.

if is_preview {
title.push_str("_preview");
}
let msg = format!("Creating namespace with title \"{}\"", title);
message::working(&msg);

let client = http::cf_v4_client(user)?;
let result = create(&client, &target, &title);
let result = create(&client, &account_id, &title);
Copy link
Contributor

Choose a reason for hiding this comment

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

we should validate the presence of account id in this command; since manifest allows it to be missing or empty, we will get back the cryptic api gateway error.

@EverlastingBugstopper EverlastingBugstopper merged commit 9beee51 into master Jun 26, 2020
@EverlastingBugstopper EverlastingBugstopper deleted the avery/fix-preview-namespace-create branch August 3, 2020 17:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants