triggerdotdev / trigger.dev

Trigger.dev is the open source background jobs platform.
https://trigger.dev/changelog
Apache License 2.0
9.32k stars 583 forks source link

feat: Ability to change the node version #1468

Open gorbak25 opened 3 days ago

gorbak25 commented 3 days ago

Is your feature request related to a problem? Please describe.

In a data processing pipeline which uses a lot of grouping operations introduced in node v21 the code fails with.

TypeError: Map.groupBy(...).entries(...).map is not a function

From what I see trigger runs on node v20.

Describe the solution you'd like to see

Allow users to change the node version in their trigger config. I understand that this will increase the testing and maintenance cost a LOT so it's probably not worth implementing.

Describe alternate solutions

  1. Document how to conditionally polifill unavailable features
  2. Warn if one uses too new features unavailable in the runtime

Additional information

No response

gorbak25 commented 3 days ago

For now I've added poly-fills directly to trigger.config.ts

// Add polifills for Node v22
// https://github.com/triggerdotdev/trigger.dev/issues/1468
import 'core-js/actual/iterator';
import 'core-js/actual/object';
import 'core-js/actual/map';
matt-aitken commented 3 days ago

Thanks, this is useful especially with the polyfills!

We're going to be adding a new runtime option for Node 22 quite soon.