Affected site: flamboyant-payne-83a356
Affected environment: https://deploy-preview-1–flamboyant-payne-83a356.netlify.app
Affected function: https://deploy-preview-1--flamboyant-payne-83a356.netlify.app/.netlify/functions/getIgImage
Greetings all!
I’ve been working on optimising a couple of features on our agency website, and have been focussing in particular on improving our Instagram feed. The Instagram Basic Display API only provides urls for large images, and we are only displaying them at 270px - That’s an awful lot of useless data we are sending to end users. On top of being bad, things like Lighthouse tend to have a bit of a problem with that.
After a couple of days and a lot of head-scratching, I managed to get Sharp up and running (well, at least I did locally) as a part of a lambda function to proxy these image requests and resize them on the fly. I had run into a bunch of issues with Sharp not working, but got around them in the end. I now have an implementation which is properly returning the resized images locally, and the function log on Netlify shows no errors (in fact, it shows the buffer that it is meant to be returning, which I would see as a good sign). However, in-browser, these requests are being returned as 502s.
There doesn’t seem to be any issue with timeouts, or anything else I can see externally or from looking at the function logs. If anyone would be able to look into this and give me a steer on what might be causing this to fall over silently, I would really appreciate it.
Single-request excerpt from the function log included for reference:
2:58:29 PM: 2020-06-03T13:58:29.219Z c1f88c61-3e1b-49d1-b68b-b9d1270c7c1a INFO <Buffer ff d8 ff db 00 43 00 04 03 03 04 03 03 04 04 04 04 05 05 04 05 07 0b 07 07 06 06 07 0e 0a 0a 08 0b 10 0e 11 11 10 0e 10 0f 12 14 1a 16 12 13 18 13 0f ... 15047 more bytes>
2:58:29 PM: Duration: 109.47 ms Memory Usage: 101 MB Init Duration: 414.55 ms
Cheers,
David