adamgibbons / ics

iCalendar (ics) file generator for node.js
ISC License
732 stars 155 forks source link

Support cloudflare worker environment #256

Closed Cologler closed 1 month ago

Cologler commented 1 year ago

Cloudflare worker does not allow generating random values in global:

Uncaught Error: Some functionality, such as asynchronous I/O, timeouts, and generating random values, can only be performed while handling a request.

Remove this line will fix the error:

https://github.com/adamgibbons/ics/blob/9c20e0d3a117ebb408183bad900a950612203568/src/defaults.js#L8

Maybe the defaults can be lazy initialization?

Cologler commented 1 month ago

Fixed by #252