Skip to content

File Upload Limit : 100kb #8329

Closed
Closed

Description

@alexcibotari

[REQUIRED] Environment info

firebase-tools: 13.34.0

Platform: Windows

[REQUIRED] Test case

Upload file bigger then 100k

[REQUIRED] Steps to reproduce

Reproduceable in Emulator only
Upload file bigger then 100k, using uploadBytes function in Frontend
The issue is in Express default limit configuration :

https://expressjs.com/en/resources/middleware/body-parser.html#:~:text=Defaults%20to%20'100kb'%20.

[REQUIRED] Expected behavior

File is uploaded

[REQUIRED] Actual behavior

Error


PayloadTooLargeError: request entity too large
    at readStream (~\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\raw-body\index.js:163:17)
    at getRawBody (~\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\raw-body\index.js:116:12)
    at read (~\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\body-parser\lib\read.js:79:3)
    at rawParser (~\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\body-parser\lib\types\raw.js:81:5)    
    at Layer.handle [as handle_request] (~\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\express\lib\router\layer.js:95:5)
    at trim_prefix (~\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\express\lib\router\index.js:328:13) 
    at ~\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\express\lib\router\index.js:286:9
    at Function.process_params (~\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\express\lib\router\index.js:346:12)
    at next (~\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\express\lib\router\index.js:280:10)        
    at rawParser (~\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\body-parser\lib\types\raw.js:76:7)    



Activity

  1. aalej commented on Mar 18, 2025

    @aalej
    Contributor

    Hey @alexcibotari, thanks for reaching out. I'm trying to reproduce this, but so far I haven't encountered the same error when using uploadBytes. Also, I think the limit for the upload size in the Storage emulator is 130mb, which is being set in

    app.use(bodyParser.raw({ limit: "130mb", type: "application/x-www-form-urlencoded" }));
    app.use(bodyParser.raw({ limit: "130mb", type: "multipart/related" }));

    Could you give this repo a try? It's a web app that uploads an image(~4mb in size) to the Storage emulator. Let me know in case I may have missed anything here. By any chance, could you share a minimal reproducible example? This will help us accurately reproduce the issue

  2. added
    Needs: Author Feedback
    on Mar 18, 2025
  3. self-assigned this
    on Mar 18, 2025
  4. joehan commented on Mar 18, 2025

    @joehan
    Member

    Looks like this might be coming from ExpressBasedEmulator.ts (and only would affect uploads from the emulator UI). I'll take a crack at addressing this.

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions