Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When deploying cloud function with 10.7.0, getting HTTP Error: 400, Invalid JSON payload received. Unknown name "skipLog": Cannot find field. #4465

Closed
countzyx opened this issue Apr 21, 2022 · 4 comments · Fixed by #4467
Assignees
Labels
api: functions Needs: Author Feedback Issues awaiting author feedback

Comments

@countzyx
Copy link

countzyx commented Apr 21, 2022

[REQUIRED] Environment info

firebase-tools: 10.7.0

Platform: macOS 12.3.1 arm64

[REQUIRED] Test case

  1. De-comment the Hello World cloud function code in index.ts.
  2. Deploy the cloud function

[REQUIRED] Steps to reproduce

firebase deploy --only functions

[REQUIRED] Expected behavior

Something like this -

=== Deploying to 'project-name'...

i  deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint

> lint
> eslint --ext .js,.ts .

Running command: npm --prefix "$RESOURCE_DIR" run build

> build
> tsc

✔  functions: Finished running predeploy script.
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
⚠  functions: missing required API cloudbuild.googleapis.com. Enabling now...
✔  functions: required API cloudfunctions.googleapis.com is enabled
i  functions: preparing functions directory for uploading...
i  functions: packaged functions (39.24K) for uploading
✔  functions: functions folder uploaded successfully
i  functions: creating Node.js xx function helloWorld(us-central1)...
✔  functions[helloWorld(us-central1)]: Successful create operation.
Function URL (helloWorld): https://project-url-goes-here/helloWorld

✔  Deploy Complete!

[REQUIRED] Actual behavior

=== Deploying to 'project-name'...

i  deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint

> lint
> eslint --ext .js,.ts .

Running command: npm --prefix "$RESOURCE_DIR" run build

> build
> tsc

✔  functions: Finished running predeploy script.
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
⚠  functions: missing required API cloudbuild.googleapis.com. Enabling now...
✔  functions: required API cloudfunctions.googleapis.com is enabled

Error: HTTP Error: 400, Invalid JSON payload received. Unknown name "skipLog": Cannot find field.

Having trouble? Try firebase [command] --help

I noticed that the src/ensureApiEnabled.ts was modified to include the { skipLog: { resBody: true } } payload in the check and enable functions, which the Firebase API is rejecting (at least in enable). Is the solution to use 10.6.0 for now?
The actual project is set to Blaze - Pay As You Go.

@countzyx countzyx added the bug label Apr 21, 2022
@colerogers
Copy link
Contributor

Hi @countzyx thanks for opening your first issue here! To figure out what's going on, can I ask you to re-run the deploy command with the debug flag and paste the output here?

firebase deploy --only functions --debug

Thanks!

@colerogers colerogers self-assigned this Apr 21, 2022
@colerogers colerogers added api: functions Needs: Author Feedback Issues awaiting author feedback labels Apr 21, 2022
taeold added a commit that referenced this issue Apr 21, 2022
The options we were including to suppresses superfluously log entries whenever we enable GCP API were being sent as payload to the POST request.

Fixes #4465
@jhuleatt
Copy link
Contributor

Thanks for reporting this, @countzyx! This is fixed in CLI version 10.7.1

@Tal-Idan
Copy link

Tal-Idan commented Jun 3, 2022

I have encoutntered the exact same issue already in:
firebase init functions

I have tried different versions (10.6.0, 10.7.0, 10.7,1, 10.8.0, Latest version) but none of them worked.

here is the debug output:

=== Functions Setup
[info]
[info] A functions directory will be created in your project with sample code
[info] pre-configured. Functions can be deployed with firebase deploy.
[info]
[debug] [2022-06-03T20:07:29.685Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2022-06-03T20:07:29.685Z] > authorizing via signed-in user (talid9980@gmail.com)
[debug] [2022-06-03T20:07:29.686Z] [iam] checking project book-list-d2798 for permissions ["firebase.projects.get"]
[debug] [2022-06-03T20:07:29.687Z] >>> [apiv2][query] POST https://cloudresourcemanager.googleapis.com/v1/projects/book-list-d2798:testIamPermissions [none]
[debug] [2022-06-03T20:07:29.688Z] >>> [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/book-list-d2798:testIamPermissions {"permissions":["firebase.projects.get"]}
[debug] [2022-06-03T20:07:30.049Z] <<< [apiv2][status] POST https://cloudresourcemanager.googleapis.com/v1/projects/book-list-d2798:testIamPermissions 200
[debug] [2022-06-03T20:07:30.049Z] <<< [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/book-list-d2798:testIamPermissions {"permissions":["firebase.projects.get"]}
[debug] [2022-06-03T20:07:30.051Z] >>> [apiv2][query] GET https://serviceusage.googleapis.com/v1/projects/book-list-d2798/services/cloudfunctions.googleapis.com [none]
[debug] [2022-06-03T20:07:30.053Z] >>> [apiv2][query] GET https://serviceusage.googleapis.com/v1/projects/book-list-d2798/services/runtimeconfig.googleapis.com [none]
[debug] [2022-06-03T20:07:31.029Z] <<< [apiv2][status] GET https://serviceusage.googleapis.com/v1/projects/book-list-d2798/services/cloudfunctions.googleapis.com 200
[debug] [2022-06-03T20:07:31.029Z] <<< [apiv2][body] GET https://serviceusage.googleapis.com/v1/projects/book-list-d2798/services/cloudfunctions.googleapis.com [omitted]
[debug] [2022-06-03T20:07:31.030Z] >>> [apiv2][query] POST https://serviceusage.googleapis.com/v1/projects/book-list-d2798/services/cloudfunctions.googleapis.com:enable [none]
[debug] [2022-06-03T20:07:31.030Z] >>> [apiv2][body] POST https://serviceusage.googleapis.com/v1/projects/book-list-d2798/services/cloudfunctions.googleapis.com:enable {"skipLog":{"resBody":true}}
[debug] [2022-06-03T20:07:31.035Z] <<< [apiv2][status] GET https://serviceusage.googleapis.com/v1/projects/book-list-d2798/services/runtimeconfig.googleapis.com 200
[debug] [2022-06-03T20:07:31.035Z] <<< [apiv2][body] GET https://serviceusage.googleapis.com/v1/projects/book-list-d2798/services/runtimeconfig.googleapis.com [omitted]
[debug] [2022-06-03T20:07:31.808Z] <<< [apiv2][status] POST https://serviceusage.googleapis.com/v1/projects/book-list-d2798/services/cloudfunctions.googleapis.com:enable 400
[debug] [2022-06-03T20:07:31.808Z] <<< [apiv2][body] POST https://serviceusage.googleapis.com/v1/projects/book-list-d2798/services/cloudfunctions.googleapis.com:enable {"error":{"code":400,"message":"Invalid JSON payload received. Unknown name "skipLog": Cannot find field.","status":"INVALID_ARGUMENT","details":[{"@type":"type.googleapis.com/google.rpc.BadRequest","fieldViolations":[{"description":"Invalid JSON payload received. Unknown name "skipLog": Cannot find field."}]}]}}
[error]
[error] Error: HTTP Error: 400, Invalid JSON payload received. Unknown name "skipLog": Cannot find field.
[debug] [2022-06-03T20:07:32.046Z] Error Context: {
"body": {
"error": {
"code": 400,
"message": "Invalid JSON payload received. Unknown name "skipLog": Cannot find field.",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"description": "Invalid JSON payload received. Unknown name "skipLog": Cannot find field."
}
]
}
]
}
},
"response": {
"statusCode": 400
}
}

@bkendall
Copy link
Contributor

bkendall commented Jun 6, 2022

@Tal-Idan can you open a new issue for this? You're hitting the issue in a new place, it looks like, in the init command rather than deploy. I can't replicate this off hand, so we'll need to know more of the options you're selecting when initializing functions. Thanks

@firebase firebase locked as resolved and limited conversation to collaborators Jun 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: functions Needs: Author Feedback Issues awaiting author feedback
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants