Skip to content

[Bug]: AWS_LAMBDA_JS_RUNTIME drops nodejs14.x (NODE_MODULE_VERSION 83) support #745

Open
@jeffgo10

Description

@jeffgo10

Summary

there was a compatibility problem when i tried to deploy Gatsby site with SSR using nodejs14.x for AWS lambda runtime. it shows an error stated Using an unsupported version of Node.js for functions: nodejs14.x. I search and noticed nodejs14.x is no longer supported in lambda. So I tried a higher version which is nodejs16.x, the build was fine without errors. but when i run a page with SSR it has a runtime error:

Error - The module '/var/task/client/gentek-www/.cache/query-engine/assets/prebuilds/linux-x64/node.abi83.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 83. This version of Node.js requires NODE_MODULE_VERSION 93. Please try re-compiling or re-installing the module (for instance, using `npm rebuild` or `npm install`).

What i noticed is your binary node.abi83.node came from your plugin and only has a specific version that is supported which is 83 (specified in plugin/src/helpers/files.ts in line 19-23):

const DEFAULT_LAMBDA_PLATFORM = 'linux'
const DEFAULT_LAMBDA_ABI = '83'
const DEFAULT_LAMBDA_ARCH = 'x64'

const LAMBDA_PLATFORM = `${DEFAULT_LAMBDA_PLATFORM}-${DEFAULT_LAMBDA_ARCH}`

Is there a way for you guys to support the new lambda runtime versions such as node16.x, node18.x and node20.x? You might want to support the new versions since 16 and 18 will be deprecated soon in lambda.

Steps to reproduce

  1. deploy a gatsby site in netlify with SSR page support using NODE_VERSION 14 and AWS_LAMBDA_JS_RUNTIME nodejs14.x
  2. you will see an error Using an unsupported version of Node.js for functions: nodejs14.x
  3. try deploying again but now using NODE_VERSION 16 and AWS_LAMBDA_JS_RUNTIME nodejs16.x
  4. successful build
  5. run the site, try the page with SSR
  6. error will be showing '.../linux-x64/node.abi83.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 83. This version of Node.js requires NODE_MODULE_VERSION 93.'

A link to a reproduction repository

No response

Plugin version

3.8.0

More information about your build

  • I am building using the CLI
  • I am building using file-based configuration (netlify.toml)

What OS are you using?

Other

Your netlify.toml file

`netlify.toml`
[context.production.environment]
  GATSBY_APP_BASE_URL = "https://***.herokuapp.com"
  DATASOURCE = "https://***.herokuapp.com"
  Q3_URL = "https://***.herokuapp.com"
  URL = "https://***.com"

[context.branch-deploy.environment]
  GATSBY_APP_BASE_URL = "https://***-staging.herokuapp.com"
  DATASOURCE = "https://***-staging.herokuapp.com"
  Q3_URL = "https://***-staging.herokuapp.com"
  URL = "https://***-www.netlify.app"

[build.processing]
  skip_processing = false
[build.processing.css]
  bundle = true
  minify = false
[build.processing.js]
  bundle = true
  minify = false
[build.processing.html]
  pretty_urls = true
[build.processing.images]
  compress = true

# Necessary for SSR
[[plugins]]
package = "@netlify/plugin-gatsby"

Configuration

`gatsby-config.js` and options
# Paste content of your `gatsby-config.js` file, and/or command line options here. Check there is no private info in there.

Environment

Environment
# Paste output from `npx envinfo` here.

Gatsby info

gatsby info
# Paste output from `gatsby info` here.

Your _redirects file

`_redirects`
# Paste content of your `_redirects` file here

Builds logs (or link to your logs)

Build logs
# Paste logs here

Function logs

Function logs
# Paste logs here

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions