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

NodeJS 16 decommissioned in January #248

Open
Exac opened this issue Sep 6, 2024 · 1 comment
Open

NodeJS 16 decommissioned in January #248

Exac opened this issue Sep 6, 2024 · 1 comment

Comments

@Exac
Copy link

Exac commented Sep 6, 2024

According to the documentation, NodeJS 16 is going to be decommissioned is January:

https://cloud.google.com/functions/docs/runtime-support

Runtime Generation Runtime ID Stacks Runtime base image Deprecation Decommission
Node.js 22 (preview only) Run functions nodejs22 google-22-full google-22-full/nodejs22 2027-04-30 2028-10-31
Node.js 20 1st gen, Run functions nodejs20 google-22-full google-22-full/nodejs20 2026-04-30 2026-10-30
Node.js 18 1st gen, Run functions nodejs18 google-22-full google-22-full/nodejs18 2025-04-30 2025-10-30
Node.js 16 1st gen, Run functions nodejs16 google-18-full google-18-full/nodjes16 2024-01-30 2025-01-30
Node.js 14 1st gen, Run functions nodejs14 google-18-full google-18-full/nodjes14 2024-01-30 2025-01-30
@Exac Exac changed the title NodeJS 16 Decomission in January NodeJS 16 decommissioned in January Sep 6, 2024
@Exac
Copy link
Author

Exac commented Sep 6, 2024

Currently, if you switch to NodeJS 18 and run the emulator, you will run into an error caused by esbuild.

$ nvm use 18
$ nx build functions
$ node node_modules/firebase-tools/lib/bin/firebase.js emulators:start
i  emulators: Starting emulators: auth, functions, firestore, database, hosting, pubsub, storage, eventarc
i  firestore: Firestore Emulator logging to firestore-debug.log
✔  firestore: Firestore Emulator UI websocket is running on 9150.
i  database: Database Emulator logging to database-debug.log
i  pubsub: Pub/Sub Emulator logging to pubsub-debug.log
i  hosting[nx-firebase-proj]: Serving hosting files from: packages/nx-firebase-proj-app/public
✔  hosting[nx-firebase-proj]: Local server: http://127.0.0.1:5000
i  ui: Emulator UI logging to ui-debug.log
i  functions: Watching "/home/exac/example-org/dist/packages/functions" for Cloud Functions...
⚠  functions: package.json indicates an outdated version of firebase-functions. Please upgrade using npm install --save firebase-functions@latest in your functions directory.
⚠  functions: Please note that there will be breaking changes when you upgrade.
⚠  functions: Your requested "node" version "16" doesn't match your global version "18". Using node@18 from host.
i  functions: Loaded environment variables from .env, .env.local.
Serving at port 8424

Error: Dynamic require of "util" is not supported
    at file:///home/exac/example-org/dist/packages/functions/main.js:12:9
    at node_modules/firebase-functions/lib/logger/index.js (file:///home/exac/example-org/dist/packages/functions/main.js:465:18)
    at __require2 (file:///home/exac/example-org/dist/packages/functions/main.js:15:51)
    at node_modules/firebase-functions/lib/params/types.js (file:///home/exac/example-org/dist/packages/functions/main.js:549:19)
    at __require2 (file:///home/exac/example-org/dist/packages/functions/main.js:15:51)
    at node_modules/firebase-functions/lib/params/index.js (file:///home/exac/example-org/dist/packages/functions/main.js:872:19)
    at __require2 (file:///home/exac/example-org/dist/packages/functions/main.js:15:51)
    at node_modules/firebase-functions/lib/common/encoding.js (file:///home/exac/example-org/dist/packages/functions/main.js:960:20)
    at __require2 (file:///home/exac/example-org/dist/packages/functions/main.js:15:51)
    at node_modules/firebase-functions/lib/v2/providers/https.js (file:///home/exac/example-org/dist/packages/functions/main.js:43834:22)

⬢  functions: Failed to load function definition from source: FirebaseError: Functions codebase could not be analyzed successfully. It may have a syntax or runtime error

┌─────────────────────────────────────────────────────────────┐
│ ✔  All emulators ready! It is now safe to connect your app. │
│ i  View Emulator UI at http://127.0.0.1:4000/               │
└─────────────────────────────────────────────────────────────┘

One possible fix is to modify the packages/functions/project.json:

{
  "targets": {
    "build": {
      "executor": "@nx/esbuild:esbuild",
      "options": {
        "esbuildOptions": {
          "banner":{
             "js":"const require = (await import('node:module')).createRequire(import.meta.url);const __filename = (await import('node:url')).fileURLToPath(import.meta.url);const __dirname = (await import('node:path')).dirname(__filename);"
            }
        }
      }
    }
  }
}

That said, this is with just the basic helloWorld example function uncommented, and initializeApp imported and called. I'm not sure if there are more issues with a more complex app.

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

1 participant