Skip to content

Conversation

@aalej
Copy link
Contributor

@aalej aalej commented Jun 3, 2025

Description

Fixes #8694

Looks like we never set the value of results in

const results: { project?: string; alias?: string } = {};
const project = await select({
message: "Which project do you want to add?",
choices: projects.map((p) => p.projectId).sort(),
});
const alias = await input({
message: "What alias do you want to use for this project? (e.g. staging)",
validate: (input) => {
return input && input.length > 0;
},
});
options.rc.addProjectAlias(alias, project);
utils.makeActiveProject(options.projectRoot!, results.alias);
logger.info();
logger.info("Created alias", clc.bold(results.alias || ""), "for", results.project + ".");
logger.info("Now using alias", clc.bold(results.alias || "") + " (" + results.project + ")");
}

so results.project and results.alias are always undefined

Scenarios Tested

Verified that old behavior matched current behavior

Old behavior (14.2.0)

$ firebase --version
14.2.0
$ firebase use
Active Project: default (aalej-6162)

Project aliases for /Users/PATH/Desktop/firebase-tools/issues/8694:

* default (aalej-6162)

Run firebase use --add to define a new project alias.
$ firebase use --add
? Which project do you want to add? aalej-6162-2
? What alias do you want to use for this project? (e.g. staging) staging

Created alias staging for aalej-6162-2.
Now using alias staging (aalej-6162-2)

Current behavior

$ firebase --version
14.5.1
$ firebase use
Active Project: default (aalej-6162)

Project aliases for /Users/PATH/Desktop/firebase-tools/issues/8694:

* default (aalej-6162)

Run firebase use --add to define a new project alias.
$ firebase use --add 
✔ Which project do you want to add? aalej-6162-2
✔ What alias do you want to use for this project? (e.g. staging) staging

Created alias staging for aalej-6162-2.
Now using alias staging (aalej-6162-2)

Sample Commands

Copy link
Contributor

@joehan joehan left a comment

Choose a reason for hiding this comment

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

Thank you!

@joehan joehan enabled auto-merge (squash) June 3, 2025 16:01
@joehan joehan merged commit c977451 into master Jun 3, 2025
48 of 50 checks passed
@joehan joehan deleted the aalej-useadd branch June 3, 2025 16:13
@github-project-automation github-project-automation bot moved this from Approved [PR] to Done in [Cloud] Extensions + Functions Jun 3, 2025
@jiechuns
Copy link

jiechuns commented Jun 3, 2025

Thank you for the quick fix!

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.

Alias name is empty / undefined when associating the app with the Firebase project

3 participants