You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue does not occur on my desktop PC, but on my weaker and older laptop (where I'm hosting my app), the loadImage() method can fail with a Request timed out error (at simple-get/index.js:75:8) when loading from an image link. I can resolve this issue myself by going into node modules and setting a 10 second timeout in either the simple-get module itself or the node-canvas module where simple-get is being called (canvas > lib > image.js), but obviously this isn't ideal because my modification can get overwritten when I update my dependencies. The loadImage() method has an options parameter, but I don't think this options parameter has anything to do with the options you can set for simple-get. If there is a way to set a timeout without locally editing simple-get or node-canvas, please enlighten me. I was able to get around this issue by rewriting my code to load the images in a slightly different way, but I'd appreciate being able to set a timeout.
Environment
Version of node-canvas: 2.11.2
Environment: node 21.4.0 on Ubuntu Server
The text was updated successfully, but these errors were encountered:
@oliverkeen15 What I did may not work for you, but previously I was pushing loadImage() calls (loading from image links) to an array in a forEach loop and then calling Promise.All() on that array to ensure that the images were loaded. I modified it to push the image links themselves to an array, which I then mapped to loadImage() calls inside of a Promise.All() call after the forEach loop terminated like so: await Promise.all(links.map(link => loadImage(link))). I've not had any issues since. Perhaps it had something to do with the calculations and whatnot in my loop sometimes interfering with the ability of loadImage to process the image links.
This was a very confusing issue to deal with as I tested many sets of image links and there seemed to be no rhyme or reason as to why only certain sets of links would consistently fail and others would not. It did not seem to have anything to do with the number of links I was processing at once and the issue was also not being caused by specific image links as far as I could tell.
Not just older hardware, I'm running into this issue when using this package on an Amazon Lambda, the only solution I could come up with was the same as yours, manually editing the simple-get package in node_modules. Considering fetch has been available since Node 18, I wonder if using a native Node API is a better idea than a dependency like simple-get since Node 16 has been EOL since 2023.
Issue
Issue does not occur on my desktop PC, but on my weaker and older laptop (where I'm hosting my app), the
loadImage()
method can fail with aRequest timed out
error (at simple-get/index.js:75:8) when loading from an image link. I can resolve this issue myself by going into node modules and setting a 10 second timeout in either the simple-get module itself or the node-canvas module where simple-get is being called (canvas > lib > image.js), but obviously this isn't ideal because my modification can get overwritten when I update my dependencies. TheloadImage()
method has an options parameter, but I don't think this options parameter has anything to do with the options you can set for simple-get. If there is a way to set a timeout without locally editing simple-get or node-canvas, please enlighten me. I was able to get around this issue by rewriting my code to load the images in a slightly different way, but I'd appreciate being able to set a timeout.Environment
The text was updated successfully, but these errors were encountered: