Image not uploading on production on render

why do I always have this issue whenever i try to upload files(images) on my production server. but it works fine on localhost

Hey,

Could you share more specifics about the issue, what you’ve attempted, and so on? While our assistance with code-related issues is somewhat limited, I’m willing to help a little bit if you can offer a deeper insight into the problem you’re encountering.

Jérémy.
Render Support, UTC+3

When I first deployed the website, I was able to upload images, but as at last month whenever i try to upload images it always gives the error above, telling cannot read properties of undefined f._id

/opt/render/project/src/node_modules/multer-gridfs-storage/lib/gridfs.js:306
Nov 3 03:24:19 PM id: f._id,
Nov 3 03:24:19 PM ^
Nov 3 03:24:19 PM
Nov 3 03:24:19 PM TypeError: Cannot read properties of undefined (reading ‘_id’)
Nov 3 03:24:19 PM at GridFSBucketWriteStream.emitFile (/opt/render/project/src/node_modules/multer-gridfs-storage/lib/gridfs.js:306:31)
Nov 3 03:24:19 PM at GridFSBucketWriteStream.emit (node:events:526:35)
Nov 3 03:24:19 PM at finish (node:internal/streams/writable:748:10)
Nov 3 03:24:19 PM at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Hey,

That’s an issue that could have a very broad spectrum of causes. I don’t think any that Render does would interfere with your application at this level though. Have you tried to debug it? To make sure you’re actually receiving the expected data before the error is thrown.

Jérémy.
Render Support, UTC+3

I have debug it, it works perfectly well on localhost, can I share a link of the project on GitHub?

Hey,

On localhost and Render are 2 different things. Have you tried to setup debug points, push the new code, and check what’s going on via the service logs?

Jérémy.
Render Support, UTC+3

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.