Strapi Version: v4.1.7
Operating System: Windows
Node Version: 16.8
Yarn Version: 1.22.17
I have a Global Single Type object which has two media fields: Logo and FooterLogo. I set the media fields via the Strapi Admin panel and now I am accessing this object via REST API and populating the media fields like this:
For some reason, the Logo field (but not the FooterLogo) field contains the huge buffer objects for the Small, Medium, and Large image formats. Thumbnail does not contain the buffer object. Any idea why this happens? Is there any documentation on how to not include the buffer object on media populatation? It is making my requests unnecessarily large.
This seems to happen after I replace media. If I delete media, upload media, and relink Logo to the new media, the buffer is not included.
This truly is such a pain. I’m getting product responses that are over 300K because of this. I’ve tried making the the field a privateAttribute… that doesn’t work. Can’t figure out a good qs (querystring) format, since the levels to turn this off are way too deep. Ugh. Strapi really does some weird things.
Just encountered this issue in 2023. Anyone figured out how to solve it?
Edit: for anyone encountering this in the future. Looks like its an issue with
strapi-provider-upload-do that is being worked on: Remove buffer from file by gcascio · Pull Request #10 · shorwood/strapi-provider-upload-do · GitHub
An alternative is to use S3 upload provider in the meantime.
Hi, I wanted to clarify that the Strapi AWS S3 provider is compatible with other S3 providers such as DigitalOcean and is the only one maintained by the core team. It is great if using the Strapi AWS S3 provider solves this issue, but if not, I will try to find a solution we can add to the documentation.