Skip to content

Conversation

@luc-mo
Copy link
Contributor

@luc-mo luc-mo commented Apr 5, 2024

Description

Recently, I encountered an issue that arose unexpectedly during the deployment of firebase functions. The error occurs due the runtime field is not recognized in the firebase.json file, thereby causing a failure in the deployment.

Fixes #6973

Deployment log:

i  deploying  functions
i  functions: preparing  codebase  default  for  deployment
i  functions: ensuring  required  API  cloudfunctions.googleapis.com  is  enabled...
i  functions: ensuring  required  API  cloudbuild.googleapis.com  is  enabled...
i  artifactregistry: ensuring  required  API  artifactregistry.googleapis.com  is  enabled...
✔ functions: required  API  cloudbuild.googleapis.com  is  enabled
✔ functions: required  API  cloudfunctions.googleapis.com  is  enabled
✔ artifactregistry: required  API  artifactregistry.googleapis.com  is  enabled

Error: `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": "nodejs20"  or  set  the  "engine"  field  in  package.json
Cleaning  up  project  directory  and  file  based  variables00:01
ERROR: Job  failed: exit  code  1

Scenarios Tested

I conducted tests by installing other versions of the package and attempting to deploy, coming to the conclusion that it was an error introduced in version 13.6.1 where the runtime property was removed from the delegateContext object declaration. The error does not occur in versions previous to 13.6.1.

I performed the test by doing an npm link of firebase-tools package and deploying my functions manually. These were deployed successfully.

Deployment log with changes:

i  functions: Loaded environment variables from .env.
i  functions: preparing . directory for uploading...
+  functions: . folder uploaded successfully
i  functions: updating Node.js 20 (1st Gen) function health(us-central1)...
i  functions: updating Node.js 20 (1st Gen) function users(us-central1)...

+  functions[health(us-central1)] Successful update operation.
+  functions[users(us-central1)] Successful update operation.

i  functions: cleaning up build files...
+  Deploy complete!

@google-cla
Copy link

google-cla bot commented Apr 5, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@inlined
Copy link
Member

inlined commented Apr 8, 2024

Looks good to me. Can you add a line to CHANGELOG.md saying:

"Fixes bug detecting functions runtime from firebase.json (#6964)"?

@luc-mo
Copy link
Contributor Author

luc-mo commented Apr 8, 2024

Added! 😄

@colerogers
Copy link
Contributor

@luc-mo It looks like the linter failed, could you run npm run format to fix the issue? I think it's probably just complaining about a newline at the end of the changelog

@luc-mo
Copy link
Contributor Author

luc-mo commented Apr 9, 2024

Fixed 😄

@inlined inlined enabled auto-merge (squash) April 9, 2024 20:12
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.

runtime field is required but was not found in firebase.json or package.json

3 participants