最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

node.js - What does this mean "Error: Upgrading from 1st Gen to 2nd Gen is not yet supported - Stack Overflow

programmeradmin0浏览0评论

What does this mean?

Error: Upgrading from 1st Gen to 2nd Gen is not yet supported. See before migrating to 2nd Gen.

We'd like to be able to fallback to deploying as a V1 function. How do we do that?

Searching seems to imply that it might be a node/firebase/firebase-functions version issue.

Also we see messages about URL errors. See below.

Here's some of the versions:

$ firebase --version
13.29.1

$ node -v
v18.18.2

$ npm list
functions@ 
├── @babel/[email protected]
├── @google/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

Error: 2 UNKNOWN: Getting metadata from plugin failed with error: URL is not a constructor

Here is the log of the firebase deploy This is very large and the full log text is in the links below.

But these are some messages that seem relevant:

[2025-02-09T15:05:37.058Z] [rules] updated release projects/prop-marketing/releases/cloud.firestore ✔ firestore: released rules firestore.rules to cloud.firestore

Error: [get_firebasesearch_results_usa(us-central1)] Upgrading from 1st Gen to 2nd Gen is not yet supported. See before migrating to 2nd Gen.

[2025-02-09T15:05:04.529Z] Validating nodejs source
⚠  functions: Runtime Node.js 18 will be deprecated on 2025-04-30 and will be decommissioned on 2025-10-31, after which you will not be able to deploy without upgrading. Consider upgrading now to avoid disruption. See  for full details on the lifecycle policy 
[2025-02-09T15:05:04.909Z] > [functions] package.json contents: {
  "name": "functions",
  "description": "Cloud Functions for Firebase",
  "scripts": {
    "lint": "",
    "serve": "firebase emulators:start --only functions",
    "shell": "firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "engines": {
    "node": "18"
  },
  "main": "index.js",
  "dependencies": {
    "@babel/register": "^7.23.7",
    "@google/generative-ai": "*",
    "algoliasearch": "^4.18.0",
    "express": "^4.18.2",
    "firebase-admin": "^11.8.0",
    "firebase-functions": "^6.3.1",
    "https-proxy-agent": "^7.0.4",
    "ioredis": "^5.4.1",
    "jsdom": "^24.0.0",
    "json-diff": "^1.0.6",
    "json-html-table": "^2.0.1",
    "mkdirp": "^3.0.1",
    "querystring": "^0.2.1",
    "stripe": "^14.23.0",
    "tradingeconomics": "^2.4.2",
    "typesense": "^1.7.2",
    "url": "^0.11.4"
  },
  "devDependencies": {
    "eslint": "^8.15.0",
    "eslint-config-google": "^0.14.0",
    "firebase-functions-test": "^3.1.0"
  },
  "private": true
}
[2025-02-09T15:05:04.909Z] Building nodejs source
i  functions: Loading and analyzing source code for codebase default to determine what to deploy 
[2025-02-09T15:05:04.910Z] Could not find functions.yaml. Must use http discovery
[2025-02-09T15:05:04.915Z] Found firebase-functions binary at '/home/ralph/github/fedex1/prop-marketing/firebase/functions/node_modules/.bin/firebase-functions'
Serving at port 8403

[2025-02-09T15:05:05.387Z] Got response from /__/functions.yaml {"endpoints":{"get_firebasesearch_results_usa":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_firebasesearch_results_usa"},"getnyc2_elasticsearch":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"getnyc2_elasticsearch"},"get_question_json":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_question_json"},"get_subscription_json":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_subscription_json"},"get_article":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_article"},"proxy":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"proxy"},"jsontohtml":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"jsontohtml"},"get_stripe_session":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_stripe_session"},"get_nyc_api_geoclient_json":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_nyc_api_geoclient_json"},"get_search_live_json":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_search_live_json"},"get_search_socrata_live_city_register_json":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_search_socrata_live_city_register_json"},"get_search_socrata_live_city_register":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_search_socrata_live_city_register"},"get_search_socrata_live_restaurants":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_search_socrata_live_restaurants"},"get_search_socrata_live_generic":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_search_socrata_live_generic"},"get_search_socrata_live_nyc_property":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_search_socrata_live_nyc_property"},"getnyc2_firebasesearch":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"getnyc2_firebasesearch"},"getnyc2_firebasesearch_nycsalary":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"getnyc2_firebasesearch_nycsalary"},"get_serp":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_serp"},"get_diff":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_diff"},"getnyc_socrata_live_paywall":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"getnyc_socrata_live_paywall"},"get_json":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_json"}},"specVersion":"v1alpha1","requiredAPIs":[],"extensions":{}}
[2025-02-09T15:05:05.408Z] Validating nodejs source

text version:

gzipped:

What does this mean?

Error: Upgrading from 1st Gen to 2nd Gen is not yet supported. See https://firebase.google.com/docs/functions/2nd-gen-upgrade before migrating to 2nd Gen.

We'd like to be able to fallback to deploying as a V1 function. How do we do that?

Searching seems to imply that it might be a node/firebase/firebase-functions version issue.

Also we see messages about URL errors. See below.

Here's some of the versions:

$ firebase --version
13.29.1

$ node -v
v18.18.2

$ npm list
functions@ 
├── @babel/[email protected]
├── @google/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

Error: 2 UNKNOWN: Getting metadata from plugin failed with error: URL is not a constructor

Here is the log of the firebase deploy This is very large and the full log text is in the links below.

But these are some messages that seem relevant:

[2025-02-09T15:05:37.058Z] [rules] updated release projects/prop-marketing/releases/cloud.firestore ✔ firestore: released rules firestore.rules to cloud.firestore

Error: [get_firebasesearch_results_usa(us-central1)] Upgrading from 1st Gen to 2nd Gen is not yet supported. See https://firebase.google.com/docs/functions/2nd-gen-upgrade before migrating to 2nd Gen.

[2025-02-09T15:05:04.529Z] Validating nodejs source
⚠  functions: Runtime Node.js 18 will be deprecated on 2025-04-30 and will be decommissioned on 2025-10-31, after which you will not be able to deploy without upgrading. Consider upgrading now to avoid disruption. See https://cloud.google.com/functions/docs/runtime-support for full details on the lifecycle policy 
[2025-02-09T15:05:04.909Z] > [functions] package.json contents: {
  "name": "functions",
  "description": "Cloud Functions for Firebase",
  "scripts": {
    "lint": "",
    "serve": "firebase emulators:start --only functions",
    "shell": "firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "engines": {
    "node": "18"
  },
  "main": "index.js",
  "dependencies": {
    "@babel/register": "^7.23.7",
    "@google/generative-ai": "*",
    "algoliasearch": "^4.18.0",
    "express": "^4.18.2",
    "firebase-admin": "^11.8.0",
    "firebase-functions": "^6.3.1",
    "https-proxy-agent": "^7.0.4",
    "ioredis": "^5.4.1",
    "jsdom": "^24.0.0",
    "json-diff": "^1.0.6",
    "json-html-table": "^2.0.1",
    "mkdirp": "^3.0.1",
    "querystring": "^0.2.1",
    "stripe": "^14.23.0",
    "tradingeconomics": "^2.4.2",
    "typesense": "^1.7.2",
    "url": "^0.11.4"
  },
  "devDependencies": {
    "eslint": "^8.15.0",
    "eslint-config-google": "^0.14.0",
    "firebase-functions-test": "^3.1.0"
  },
  "private": true
}
[2025-02-09T15:05:04.909Z] Building nodejs source
i  functions: Loading and analyzing source code for codebase default to determine what to deploy 
[2025-02-09T15:05:04.910Z] Could not find functions.yaml. Must use http discovery
[2025-02-09T15:05:04.915Z] Found firebase-functions binary at '/home/ralph/github.com/fedex1/prop-marketing/firebase/functions/node_modules/.bin/firebase-functions'
Serving at port 8403

[2025-02-09T15:05:05.387Z] Got response from /__/functions.yaml {"endpoints":{"get_firebasesearch_results_usa":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_firebasesearch_results_usa"},"getnyc2_elasticsearch":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"getnyc2_elasticsearch"},"get_question_json":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_question_json"},"get_subscription_json":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_subscription_json"},"get_article":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_article"},"proxy":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"proxy"},"jsontohtml":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"jsontohtml"},"get_stripe_session":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_stripe_session"},"get_nyc_api_geoclient_json":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_nyc_api_geoclient_json"},"get_search_live_json":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_search_live_json"},"get_search_socrata_live_city_register_json":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_search_socrata_live_city_register_json"},"get_search_socrata_live_city_register":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_search_socrata_live_city_register"},"get_search_socrata_live_restaurants":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_search_socrata_live_restaurants"},"get_search_socrata_live_generic":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_search_socrata_live_generic"},"get_search_socrata_live_nyc_property":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_search_socrata_live_nyc_property"},"getnyc2_firebasesearch":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"getnyc2_firebasesearch"},"getnyc2_firebasesearch_nycsalary":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"getnyc2_firebasesearch_nycsalary"},"get_serp":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_serp"},"get_diff":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_diff"},"getnyc_socrata_live_paywall":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"getnyc_socrata_live_paywall"},"get_json":{"availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"concurrency":null,"serviceAccountEmail":null,"vpc":null,"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"get_json"}},"specVersion":"v1alpha1","requiredAPIs":[],"extensions":{}}
[2025-02-09T15:05:05.408Z] Validating nodejs source

text version: https://docs.google.com/document/d/16t7rhovhIvdIq_Cf6BAqN4C57wPizNOprVeSls6EII0/edit?usp=drive_link

gzipped: https://drive.google.com/file/d/1rzvQbgHRmzX14pJzXfS2rELFuGMtCXL4/view?usp=sharing

Share Improve this question edited yesterday Frank van Puffelen 599k85 gold badges888 silver badges858 bronze badges Recognized by Google Cloud Collective asked yesterday Ralph YozzoRalph Yozzo 1,13213 silver badges27 bronze badges 7
  • 1 Please edit the question to show the code that doesn't work the way you expect. We should be able to copy that along with your instructions to reproduce the issue. – Doug Stevenson Commented yesterday
  • @dougstevenson I will edit the question but that is part of the root of the issue is that it works locally with the firebase local development environment. The error messages are on the cloud environment. And it gives hundreds and hundreds of lines of errors. Thanks. – Ralph Yozzo Commented yesterday
  • Could you edit the question to include what you just said, along with more details about your observations? Burying information in comments isn't ideal. Full steps to repro your observations the issue is ideal. See: stackoverflow.com/help/minimal-reproducible-example – Doug Stevenson Commented yesterday
  • Without package.json this isn't too reproducible, while everything hints for different nodeJS versions. The expected question format would indeed be: the code which produces the problem + relevant log entries or stack trace. – Martin Zeitler Commented yesterday
  • 1 Also don't provide links to external resources. Everything should be copied into the question itself so it's easy to read, copy and search for others in the future. – Doug Stevenson Commented yesterday
 |  Show 2 more comments

1 Answer 1

Reset to default 1

In order to migrate to v2, you might want to upgrade the local nodeJS version first. Running different nodeJS versions locally and remotely tends to be problematic. The local environment should match the remote environment as close as possible, when using nodeJS or PHP runtime. For example: When setting "engines": {"node": "20"}, one should also run NodeJS 20 locally.

When upgrading the deployment from v1 to v2 isn't possible, you might have to delete the function, which makes it inaccessible for a short period of time. When no or only little traffic is hitting the function, nothing speaks against doing just that.

But when traffic is hitting the function, the most seamless migration strategy might still be: To deploy v2 with another function name, then push a new version of the client. And after some time, one can remove the v1 function. This scenario is basically also described in the documentation.


All the v2 quickstarts use NodeJS 22 and a later version of firebase-admin.

发布评论

评论列表(0)

  1. 暂无评论