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

HTTP Error: 400, Unknown Error for exceeding the Cloud Function Max deployment size #4203

Closed
rscotten opened this issue Feb 22, 2022 · 10 comments
Assignees

Comments

@rscotten
Copy link

[REQUIRED] Environment info

firebase-tools: 9.16.5

Platform: macOS

[REQUIRED] Test case

Unnecessary for this bug; just improve the server-side error messaging.

[REQUIRED] Steps to reproduce

The Cloud Function Max Deployment size is:

100MB (compressed) for sources.
500MB (uncompressed) for sources plus modules

Source

When exceeding this, the Firebase CLI error is:

Error: HTTP Error: 400, Unknown Error

Screen Shot 2022-02-22 at 7 47 30 AM

[REQUIRED] Expected behavior

Error: HTTP Error: 4xx, Exceeded Cloud Function max deployment size of 100MB (compressed) for sources

or

Error: HTTP Error: 4xx, Exceeded Cloud Function max deployment size of 500MB (uncompressed) for sources plus modules

[REQUIRED] Actual behavior

Error: HTTP Error: 400, Unknown Error

@rscotten rscotten added the bug label Feb 22, 2022
@bkendall
Copy link
Contributor

I believe #4180 helped to address this - if you update to the latest firebase-tools, you should see different error messaging. @taeold to confirm...

@taeold
Copy link
Contributor

taeold commented Feb 22, 2022

@bkendall @rscotten That's right. The latest release should give you slightly better error message, e.g.

⚠  functions: Upload Error: HTTP Error: 400, <?xml version='1.0' encoding='UTF-8'?><Error><Code>EntityTooLarge</Code><Message>Your proposed upload is larger than the maximum object size specified in your Policy Document.</Message><Details>Content-length exceeds upper bound on range</Details></Error>

Error: HTTP Error: 400, <?xml version='1.0' encoding='UTF-8'?><Error><Code>EntityTooLarge</Code><Message>Your proposed upload is larger than the maximum object size specified in your Policy Document.</Message><Details>Content-length exceeds upper bound on range</Details></Error>

Can you give the latest version a spin and let us know?

@rscotten
Copy link
Author

@bkendall @taeold

I updated to version 10.2.1 and got the same "Unknown Error" error:

Screen Shot 2022-02-22 at 12 45 27 PM

@taeold
Copy link
Contributor

taeold commented Feb 22, 2022

@rscotten Thanks for taking the time! I'll try to see what I missed in my last round 🤔

If you have sometime, I'd really appreciate if you can share the output of runnign firebase deploy --only:functions --debug (with the --debug flag) 🙏🏼 .

@rscotten
Copy link
Author

@taeold

[2022-02-22T19:07:38.053Z] <<< HTTP RESPONSE 400 {"x-guploader-uploadid":"ADPycduMm0k6yHhvscO9vrWUUoDtVG_Me2shMah6oVQlDadgav9LAZTVuEzKBmndcLt4eLhaMc-X_p0g_wUvMZpETrc","content-type":"application/xml; charset=UTF-8","content-length":"255","vary":"Origin","date":"Tue, 22 Feb 2022 19:07:38 GMT","server":"UploadServer","alt-svc":"h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\""}
[2022-02-22T19:07:38.056Z] <<< HTTP RESPONSE BODY <?xml version='1.0' encoding='UTF-8'?><Error><Code>EntityTooLarge</Code><Message>Your proposed upload is larger than the maximum object size specified in your Policy Document.</Message><Details>Content-length exceeds upper bound on range</Details></Error>
⚠  functions: Upload Error: HTTP Error: 400, Unknown Error 

Error: HTTP Error: 400, Unknown Error
[2022-02-22T19:07:38.181Z] Error Context: {
  "body": {
    "error": {
      "message": "Unknown Error"
    }
  },
  "response": {
    "statusCode": 400,
    "body": "<?xml version='1.0' encoding='UTF-8'?><Error><Code>EntityTooLarge</Code><Message>Your proposed upload is larger than the maximum object size specified in your Policy Document.</Message><Details>Content-length exceeds upper bound on range</Details></Error>",
    "headers": {
      "x-guploader-uploadid": "ADPycduMm0k6yHhvscO9vrWUUoDtVG_Me2shMah6oVQlDadgav9LAZTVuEzKBmndcLt4eLhaMc-X_p0g_wUvMZpETrc",
      "content-type": "application/xml; charset=UTF-8",
      "content-length": "255",
      "vary": "Origin",
      "date": "Tue, 22 Feb 2022 19:07:38 GMT",
      "server": "UploadServer",
      "alt-svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\""
    },
    "request": {
      "uri": {
        "protocol": "https:",
        "slashes": true,
        "auth": null,
        "host": "storage.googleapis.com",
        "port": 443,
        "hostname": "storage.googleapis.com",
        "hash": null,
        "search": "?GoogleAccessId=service-21372694838@gcf-admin-robot.iam.gserviceaccount.com&Expires=1645558568&Signature=pCEZbgfHQ27KjytcSehUimbtpEio0NEEmEf1LTxDVMPLHHZKBkTfKnehSctngh9CdK55qgXOECoxBsddUw8jWjjFc7dL0XHkomcJ52e20u3k%2FG1ipyLNU1jOxZbizffT396VTOpMPy4UbEkFPG5J6VANzAZa61qdF5VHjonJZAVb9iOOloFYiqcc8Y%2FUvN%2BeiT0Jm9kvGTLNiAcJtE7CSNx6SvY5nKQIiD9hFDaGNjJyYGlR9ppc%2Bppc1CHJVRjgzcCc98I2eW%2FQViLj0wMyhP3e%2BZIKIayB2RJBjqS5RJaudH7U0TlDQNeELjAR4YSvGmEhOicq6Tz1xL8jc9uprA%3D%3D",
        "query": "GoogleAccessId=service-21372694838@gcf-admin-robot.iam.gserviceaccount.com&Expires=1645558568&Signature=pCEZbgfHQ27KjytcSehUimbtpEio0NEEmEf1LTxDVMPLHHZKBkTfKnehSctngh9CdK55qgXOECoxBsddUw8jWjjFc7dL0XHkomcJ52e20u3k%2FG1ipyLNU1jOxZbizffT396VTOpMPy4UbEkFPG5J6VANzAZa61qdF5VHjonJZAVb9iOOloFYiqcc8Y%2FUvN%2BeiT0Jm9kvGTLNiAcJtE7CSNx6SvY5nKQIiD9hFDaGNjJyYGlR9ppc%2Bppc1CHJVRjgzcCc98I2eW%2FQViLj0wMyhP3e%2BZIKIayB2RJBjqS5RJaudH7U0TlDQNeELjAR4YSvGmEhOicq6Tz1xL8jc9uprA%3D%3D",
        "pathname": "/gcf-upload-us-central1-f0c7a74e-bccd-4ed6-9514-fc5a1f24dd94/9fa1893c-28fa-410f-bd6b-ce2621b78b34.zip",
        "path": "/gcf-upload-us-central1-f0c7a74e-bccd-4ed6-9514-fc5a1f24dd94/9fa1893c-28fa-410f-bd6b-ce2621b78b34.zip?GoogleAccessId=service-21372694838@gcf-admin-robot.iam.gserviceaccount.com&Expires=1645558568&Signature=pCEZbgfHQ27KjytcSehUimbtpEio0NEEmEf1LTxDVMPLHHZKBkTfKnehSctngh9CdK55qgXOECoxBsddUw8jWjjFc7dL0XHkomcJ52e20u3k%2FG1ipyLNU1jOxZbizffT396VTOpMPy4UbEkFPG5J6VANzAZa61qdF5VHjonJZAVb9iOOloFYiqcc8Y%2FUvN%2BeiT0Jm9kvGTLNiAcJtE7CSNx6SvY5nKQIiD9hFDaGNjJyYGlR9ppc%2Bppc1CHJVRjgzcCc98I2eW%2FQViLj0wMyhP3e%2BZIKIayB2RJBjqS5RJaudH7U0TlDQNeELjAR4YSvGmEhOicq6Tz1xL8jc9uprA%3D%3D",
        "href": "https://storage.googleapis.com/gcf-upload-us-central1-f0c7a74e-bccd-4ed6-9514-fc5a1f24dd94/9fa1893c-28fa-410f-bd6b-ce2621b78b34.zip?GoogleAccessId=service-21372694838@gcf-admin-robot.iam.gserviceaccount.com&Expires=1645558568&Signature=pCEZbgfHQ27KjytcSehUimbtpEio0NEEmEf1LTxDVMPLHHZKBkTfKnehSctngh9CdK55qgXOECoxBsddUw8jWjjFc7dL0XHkomcJ52e20u3k%2FG1ipyLNU1jOxZbizffT396VTOpMPy4UbEkFPG5J6VANzAZa61qdF5VHjonJZAVb9iOOloFYiqcc8Y%2FUvN%2BeiT0Jm9kvGTLNiAcJtE7CSNx6SvY5nKQIiD9hFDaGNjJyYGlR9ppc%2Bppc1CHJVRjgzcCc98I2eW%2FQViLj0wMyhP3e%2BZIKIayB2RJBjqS5RJaudH7U0TlDQNeELjAR4YSvGmEhOicq6Tz1xL8jc9uprA%3D%3D"
      },
      "method": "PUT"
    }
  }
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
$ firebase -V
10.2.1

@taeold
Copy link
Contributor

taeold commented Feb 22, 2022

@rscotten Huh I'm baffled. On my machine, the XML error does log nicely 🤔

Going to go off to see if I'm just a little too tired and now seeing an obvious bug.

@thanishahamed
Copy link

thanishahamed commented Apr 1, 2022

@rscotten

I faced the same issue,

I tried the followings.

  • Removed deployment history in firebase hosting
  • Removed node_modules directory
  • Removed .next directory

then,

  • npm install
  • npm run build

And deployed my nextjs to the firebase function.

This reduced 117MB upload file size to 11 MB file size and successfully deployed.

Thank You!

@MorenoMdz
Copy link

Had the same issue, which in our case was caused by Prod backups we had in the local export folder we use. Removing that data fixed the deploy payload size issue.

@joehan
Copy link
Contributor

joehan commented Apr 25, 2022

Hey all, I'm going to close this since the error message is now more clear, and we don't have control over the max cloud functions upload size. If you run into this issue, please double check that you are not including anything unnecessary in the deployment

@joehan joehan closed this as completed Apr 25, 2022
@kmiterror
Copy link

I had the same problem, size of my package was around 140MB.
Week ago it was closer to 40MB.
As I found, the problem might be with the ignore section in firebase.json
As per this comment #1602 (comment) it seems that ignore is not additive.

This means that if anything is specified in ignore section, default values are not included anymore therefore node_modules is not excluded from the package, and this in turn means that the packages size gets very big.
So the solution is to specify "**/node_modules/**" in ignore section.
When I did this my package size went down from 140MB to 290KB.

"ignore": [
      "src/functions/views/**",
      "**/node_modules/**"
    ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants