DSG enabled pages giving 500 server error

Hi I enabled DSG on ohiostaging.mycartlauncher.com for some specific pages.


Whenever I try to access these pages it gives 500 error.
Don’t know what is the issue site is built with gatsby.
I’ve added both the plugins and packages as mentioned in documentation and have followed all the steps.
image

The plugins are loaded as supposed to be.


The deferred pages are detected in logs also.
image

Any solution or direction?

Any help on that? I couldn’t find any right directions

Hey there @detosk :wave:

Thanks for reaching out and welcome to the Netlify Forums. Sorry to hear you’re encountering this issue. Can you please share you most recent deploy log with us as well as your project repo, if it is public?

Thanks.

Hey @detosk,

The page is loading fine for me for the given link. Are you sure that’s the correct link?

This is the main link to the site deferred pages are product pages.
Like this one: https://62012bfbdcbc1d0008521095--tender-galileo-fdd375.netlify.app/products/1200-peak-amp-portable-car-jump-starterportable-power-station-with-120-psi-compressor-and-500-watt-p/


All the product detail pages in here are giving 500 error and if I disable dsg it works fine and render product detail page.

Hey @detosk,

I can see some logs in your functions:

Feb 13, 10:21:00 PM: ebd60328 error Error: ENOENT: no such file or directory, open '/opt/build/repo/.cache/caches/gatsby-source-custom-api/44b5d8b9f62a9d1bf85708e10185900a/EoHoW6.jpeg'
Feb 13, 10:21:00 PM: ebd60328 at Object.openSync (fs.js:497:3)
Feb 13, 10:21:00 PM: ebd60328 at Object.readFileSync (fs.js:393:35)Feb 13, 10:21:00 PM: ebd60328 at Object.lfs.<computed> [as readFileSync] (/var/task/.netlify/functions-internal/__dsg/__dsg.js:3284:24)Feb 13, 10:21:00 PM: ebd60328 at Function.hasha.fromFileSync (/var/task/.cache/query-engine/index.js:175592:54)
Feb 13, 10:21:00 PM: ebd60328 at createFileHash (/var/task/.cache/query-engine/index.js:175130:25)
Feb 13, 10:21:00 PM: ebd60328 at /var/task/.cache/query-engine/index.js:175283:22
Feb 13, 10:21:00 PM: ebd60328 at Array.map (<anonymous>)
Feb 13, 10:21:00 PM: ebd60328 at createInternalJob (/var/task/.cache/query-engine/index.js:175280:50)
Feb 13, 10:21:00 PM: ebd60328 at /var/task/.cache/query-engine/index.js:177000:23Feb 13, 10:21:00 PM: ebd60328 at /var/task/.cache/query-engine/index.js:52897:18Feb 13, 10:21:00 PM: ebd60328 at /var/task/.cache/query-engine/index.js:26666:12Feb 13, 10:21:00 PM: ebd60328 at Object.doubleBoundActionCreators.<computed> [as createJobV2] (/var/task/.cache/query-engine/index.js:160607:20)
Feb 13, 10:21:00 PM: ebd60328 at createJob (/var/task/.cache/query-engine/index.js:186952:27)Feb 13, 10:21:00 PM: ebd60328 at batchQueueImageResizing (/var/task/.cache/query-engine/index.js:187044:27)
Feb 13, 10:21:00 PM: ebd60328 at generateImageData (/var/task/.cache/query-engine/index.js:193095:48)
Feb 13, 10:21:00 PM: ebd60328 at resolve (/var/task/.cache/query-engine/index.js:292538:25)
Feb 13, 10:21:00 PM: ebd60328 Duration: 100.57 ms	Memory Usage: 578 MB	

It appears that your your custom source API is somehow failing?

HI where can I find these logs?

These are available in the _dsg function in your site’s Functions’ tab.

Thank you! I definitely never came across these logs or knew that these exist. I’ll look into the details and come back if needed. Thank you again!

@hrishikesh Does that mean I missing caching in my plugin?
On first deploy or deploy with clearing cache, the pages give 500 error but on next re-deploy, I believe cache is available and it creates the pages on runtime.

Hey @detosk,

We had a talk with our Gatsby experts and they suggest not to use image transformations in DSG. You’d have to include the images in your functions and that would bump your function size and make it unusable after a point.

hi @hrishikesh ,
Thank you for the follow up. I’m a bit confused here. By image transformations, you mean gatsby-transformer-sharp plugin that I’m using?
and secondly, I completely lost you, what do you mean by "You’d have to include the images in your functions " is that equivalent to fetching images by making API requests or CDN links?
Can you explain this one or refer to some docs?
We are dealing with clients with more than 1000+ e-commerce products and stuck with this issue for quite longer than expected!

Thank you!

Apologies for not being more clear, but here you go:

Yes, that would work if you’ve 1 or 2 images to transform, but if you’re planning to use it for purposes like yours, that would be an issue (reasons explained below).

So to transform the images, the images need to exist in your function bundle. The function bundle is a zip of all the Node Modules and files required by your function to run on AWS Lambda. AWS imposes a limit of 50 MB for this zip. So if you’ve to include a lot of images to transform, you’d have to add those to your function’s bundle. That would blow up the size beyond 50 MB and your site won’t be deployed.

More on including files here:

So, you might have to rely on some other image provider that would give you runtime transformations.