Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EventBus.ts retrierFn lacks a configuration option for runtime: option #3747

Open
elliscode opened this issue Apr 19, 2024 · 3 comments
Open

Comments

@elliscode
Copy link

elliscode commented Apr 19, 2024

See EventBus.ts in the definition of retrierFn

runtime: lambda.Runtime.NODEJS_18_X,

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"
@cold-logic
Copy link

I'm also seeing the runtime for lambda functions hardcoded at nodejs18.x... I'd like to be able to use nodejs20.x

@elliscode
Copy link
Author

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.

@misterjoessef
Copy link

@cold-logic right what is that about?

can someone provide some clarity on why the Function, and EventBus's runtimes are hardcoded?

runtime: CDKRuntime.NODEJS_18_X,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants