Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ const supportedNodeVersions: string[] = Object.keys(supported.RUNTIMES)
.map((s) => s.substring("nodejs".length));

export const RUNTIME_NOT_SET =
"`runtime` field is required but was not found in firebase.json or package.json.\n" +
"To fix this, add the following lines to the `functions` section of your firebase.json:\n" +
`"runtime": "${supported.latest("nodejs")}" or set the "engine" field in package.json\n`;
`\`runtime\` field is required but was not found in firebase.json or package.json.
To fix this, add the following lines to the \`functions\` section of your firebase.json:
"runtime": "${supported.latest("nodejs")}" or set the "engines" field in package.json`;
Comment on lines +16 to +18
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

While fixing the typo is a great improvement, the error message could be made even clearer. The current phrasing might be ambiguous to users about how to resolve the issue. Presenting the two available options as a numbered list would improve readability and provide a better user experience.

  `\`runtime\` field is required but was not found in firebase.json or package.json.\nTo fix this, please specify a runtime in either of the following ways:\n1. Add \`"runtime": "${supported.latest("nodejs")}"\` to the \`functions\` section of your firebase.json.\n2. Set the \`engines\` field in your package.json (e.g. \`"engines": { "node": "20" }\`).`


function getRuntimeChoiceFromPackageJson(sourceDir: string): supported.Runtime {
const packageJsonPath = path.join(sourceDir, "package.json");
Expand Down