API photo upload returns 500 error from Multer

Platform: NodeJS + Typescript + Axios application using the iNaturalist API

URLs: https://www.inaturalist.org/pages/api+reference#post-observation_photos

Description of problem:

Step 1: Using a high resolution image, attempt to upload full resolution or something at least 2400px wide using this API route: https://www.inaturalist.org/pages/api+reference#post-observation_photos. An image I used is below.

Step 2: Receive response from API with this error message:

MulterError: Field value too long<br>
    at abortWithCode (/home/inaturalist/deployment/api/releases/20200914204728/node_modules/multer/lib/make-middleware.js:79:22)<br>
    at Busboy.&lt;anonymous&gt; (/home/inaturalist/deployment/api/releases/20200914204728/node_modules/multer/lib/make-middleware.js:85:34)<br>
    at Busboy.emit (events.js:210:5)<br>
    at Busboy.emit (/home/inaturalist/deployment/api/releases/20200914204728/node_modules/busboy/lib/main.js:38:33)<br>
    at PartStream.onEnd (/home/inaturalist/deployment/api/releases/20200914204728/node_modules/busboy/lib/types/multipart.js:261:15)<br>
    at PartStream.emit (events.js:215:7)<br>
    at endReadableNT (_stream_readable.js:1183:12)<br>
    at Shim.applySegment (/home/inaturalist/deployment/api/releases/20200914204728/node_modules/newrelic/lib/shim/shim.js:1390:20)<br>
    at wrapper (/home/inaturalist/deployment/api/releases/20200914204728/node_modules/newrelic/lib/shim/shim.js:2014:17)<br>
    at processTicksAndRejections (internal/process/task_queues.js:80:21)

Step 3:
Repeat, reducing image pixel size, until the error stops. I got the error at 2400px, but not at 1200px. I did not test in between these sizes.

Image I used:

(image is copyright by me, please don’t use)

Thanks,

Welcome to the community! Is this perhaps related to the 2048 edge length limit on a photo - perhaps the API endpoint does not trigger the required resizing? See also:
https://forum.inaturalist.org/t/increase-max-image-size-from-2048-x-2048-pixels/13627

2 Likes

Thanks @danaleeling. I had not seen that post you referenced.

1 Like

This seems possibly related: https://github.com/expressjs/multer/issues/436

seems like danaleeling’s post solves the issue here, right? (time to officially close the bug report, right?)

1 Like