Automattic / Automattic/node-canvas

The loadImage() method can fail with Request timed out error on older hardware

Open
#2,363 4 comments 2 reactions 0 assignees View on GitHub
Feature
Dominant language
JavaScript
Stars
10.7k
Forks
1.2k
Avg merge
4d 8h
Merged PRs (30d)
1

Description

## Issue
- [x] If this is an issue with installation, I have read the [troubleshooting guide](https://github.com/Automattic/node-canvas/issues/1511).

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.