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

feature: add support for nodejs14.x #1170

Merged
merged 2 commits into from Feb 10, 2021

Conversation

adikari
Copy link
Contributor

@adikari adikari commented Feb 4, 2021

Description

AWS Lambda now supports nodejs14.x. Updated the package to support this version.

Motivation and Context

Without this support, an error is thrown when trying to run serverless offline on projects that use node 14.

How Has This Been Tested?

I made changes to the config file in serverless-offline. Then used yarn link to link the local package and used it in one of my nodejs 14 serverless projects. It did not throw an error after the changes and ran the code as expected.

Screenshots (if appropriate):

@adikari adikari marked this pull request as draft February 4, 2021 12:27
@adikari adikari marked this pull request as ready for review February 4, 2021 12:39
@XuluWarrior
Copy link

Does this also require an additional docker test?
e.g. https://github.com/dherault/serverless-offline/tree/master/tests/integration/docker/nodejs/nodejs12.x

@connorads connorads mentioned this pull request Feb 6, 2021
@frozenbonito
Copy link
Collaborator

Blocked by lambci/docker-lambda#329.

@bryanvaz
Copy link

@frozenbonito is there a way to put this on a @next package pending a node14 version of lambci?

It looks like lambci is going to be a while, and serverless-webpack just added node14 support as well. (They also don't use lambci for integration tests, which is a concern for another day)

Funny thing is that I deployed on node14 yesterday and it worked without any issue, only this afternoon when testing did I realized serverless-offline had this check. 🤣 so lol for doing things out of order.

@frozenbonito
Copy link
Collaborator

@bryanvaz Sorry, I don't have permission to release this npm. Only reviews and merges.

@bryanvaz
Copy link

okay dokey @frozenbonito. Since it's for development, I'm sure we can all use whatever branch you want to throw the update on in the mean time.

@frozenbonito
Copy link
Collaborator

I made that using nodejs14.x runtime and --withDocker option will output warning and throw error.

Thank you for your contribution @adikari, I'll merge this PR.

@frozenbonito frozenbonito merged commit ab8ff9d into dherault:master Feb 10, 2021
@adikari adikari deleted the support-nodejs14 branch February 10, 2021 23:00
@harishreddy-m
Copy link

When can we expect the next release along with this fix?

@adikari
Copy link
Contributor Author

adikari commented Feb 15, 2021

when are we releasing this? I am having to use local yarn link for now :(

@claylevering
Copy link

👍🏻 to requesting this release sooner than later

@QAnders
Copy link

QAnders commented Feb 18, 2021

It would be really nice to get this in... Had to manually add it to be able to continue local testing/dev... Thanks!

@claylevering
Copy link

As a note to anyone else that might do similar, I hacked a workaround by using a stage variable on my runtime:
runtime: ${self:custom.runtime.${self:custom.stage}}

This lets dev be 12.x (weird) but prod be 14.x

@ilionic
Copy link

ilionic commented Feb 26, 2021

Please release this version.

@nfantone
Copy link

nfantone commented Mar 2, 2021

Any movement here? What's the hold up? Something we could help with?

@restapisolutions
Copy link

I need this in release... No... I needed it a week ago.
Any workarounds?
Since it's only for development, should I clone, build and yarn link the master into my project?

@bryanvaz
Copy link

bryanvaz commented Mar 5, 2021

I need this in release... No... I needed it a week ago.
Any workarounds?
Since it's only for development, should I clone, build and yarn link the master into my project?

Try running this snippet, it should help solve your problem:

if (serverlessOffline.release().releaseDate < Date.now()) {
  if (Wallet.hasMonies()) {
    await serverlessOffline.sponsor(wallet: Wallet.authorize());
  } else {
    Github.fork(repo: 'serverless-offline');
  }
}

@hitwill
Copy link

hitwill commented Mar 7, 2021

Here is a temp fix that worked for me:

const isRunningLocally = !process.env.AWS_EXECUTION_ENV;
...
runtime: isRunningLocally ? "nodejs12.x" : "nodejs14.x" 

You change the runtime based on AWS environment variables that aren't available locally

@omar-dulaimi
Copy link

Hello, I'm getting the:

offline: Warning: found unsupported runtime 'nodejs14.x' for function 'graphql'
node_modules/serverless/lib/classes/CLI.js:349
offline: Failure: Unsupported runtime
node_modules/serverless/lib/classes/CLI.js:349
Error: Unsupported runtime

Any fixes for that?

@bboure
Copy link

bboure commented Mar 23, 2021

Any chance of getting a release including this fix soon?

Thank you!

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

Successfully merging this pull request may close these issues.

None yet