Sharp or jimp libraries support in Workers?
Hello I am trying to deploy a hono app as worker. My app uses sharp but realised that it is not compatible. So i implemented jimp instead since it is JS native but still having issues deploying.
- [10021] Uncaught Error: Disallowed operation called within global scope. Asynchronous I/O (ex: fetch() or connect()), setting a timeout, and generating random values are not allowed within global scope. To fix this error, perform this operation within a handler. https://developers.cloudflare.com/workers/runtime-apis/handlers/
at index.js:51075:20 in runTimeout
at index.js:51162:13 in process2.nextTick
at index.js:40321:20
at index.js:40683:12 in 67../gif
at index.js:28991:25 in o
at index.js:28993:24
at index.js:41010:41 in 70../bitmapimage
at index.js:28991:25 in o
at index.js:28993:24
at index.js:65133:26
(https://developers.cloudflare.com/workers/observability/errors/#validation-errors-10021)
Cloudflare Docs
Methods, such as
fetch(), on Workers that can receive and process external inputs.