EventBus.ts retrierFn lacks a configuration option for runtime: option
elliscode opened this issue · comments
See EventBus.ts in the definition of retrierFn
sst/packages/sst/src/constructs/EventBus.ts
Line 611 in ea060f1
runtime
is hard-coded to NODEJS_18_X
I want to be able to manually configure this runtime
value to a different version of node for compliance purposes within my organization.
I am proposing this could be done through a configuration parameter in the third argument to the subscribe
method, much like the defaults
block in the Function
constructor.
Like this for example:
bus.subscribe(EventType.ERROR, {
handler: "...",
}, {
retries: 3,
runtime: "nodejs20.x",
});
In the absence of this additional parameter, it would default to whatever the function default was provided to the function. If that is also empty, it would default to Node JS 18.x (as it does now), following this logic:
props?.runtime || this.props.defaults?.function?.runtime || "nodejs18.x"
I'm also seeing the runtime for lambda functions hardcoded at nodejs18.x
... I'd like to be able to use nodejs20.x
Hacky fix for anyone who runs into this in the future: run this command in the directory where your node_modules
are located:
sed -i -e 's/NODEJS_18_X/NODEJS_20_X/' $(find . -name "EventBus.js")
What this does is $(find . -name "EventBus.js")
finds the path of the EventBus.js
within your node_modules
directory, then the sed
command replaces the NODEJS_18_x
with NODEJS_20_x
in only the EventBus.js file.
You can use this on older versions of SST as well if you can't upgrade to the latest version for whatever reason, for example SST 2.19.1 uses NODEJS_14_x
.
@cold-logic right what is that about?
can someone provide some clarity on why the Function, and EventBus's runtimes are hardcoded?
sst/packages/sst/src/constructs/Function.ts
Line 921 in 6f8fb48