fix(cli): use template alias for migrate build name#1563
Conversation
migrate fell back to template_id as Template.build(..., name). That argument is the human-readable alias, so rebuilding with the opaque ID self-collides (409). Prefer template_name, then resolve aliases via the templates API, and only fall back to template_id with a warning. Fixes e2b-dev#1478
|
We require contributors to sign our Contributor License Agreement, and we don't have @Solaris-star on file. You can sign our CLA at https://e2b.dev/docs/cla . Once you've signed, post a comment here that says '@cla-bot check' |
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f16290c625
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| async function resolveMigrateBuildName( | ||
| config: E2BConfig, | ||
| nameOverride?: string | ||
| ): Promise<string> { |
There was a problem hiding this comment.
Add a changeset for the CLI fix
The repo-root AGENTS.md says, “Generate a changeset when updating packages/cli…”, but this commit changes packages/cli source/tests without adding or updating a .changeset entry for @e2b/cli; as a result this user-facing CLI fix can be omitted from the next package version/changelog. Please add a changeset describing the migrate alias fix.
Useful? React with 👍 / 👎.
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
|
@cla-bot check |
Summary
e2b template migratewrotetemplate_idinto the second argument ofTemplate.build/AsyncTemplate.buildwhentemplate_namewas absent. That argument is the template name (alias), not the internal ID. Rebuilding with the ID as a new alias collides with the existing template →409 Alias already used.Change
template_name/--namefor the generated build scriptstemplate_idis present, list templates and use the first alias for that IDtemplate_idonly with a clear warning (and document--name)template_namewins over an opaquetemplate_idinbuild_prod.py/build_dev.pyTest plan
template_id+template_nameemits the alias, not the IDpython build_prod.pywithout 409Fixes #1478