nuxt3 应用 Firebase 部署意外错误。如何?[发生意外错误。] [TypeError: 无法读取 null 的属性(读取“匹配”)]

问题描述 投票:0回答:1

StackOverflow 社区您好,

我在尝试使用 Firebase 部署项目时遇到了意外错误。错误突然发生;直到 8 月 28 日,一切都运转良好。这是背景和我收到的错误消息:

GitHub 存储库 https://github.com/toriumi72/LINE_shift/tree/master

背景:

  • 部署命令:
    firebase deploy
  • Firebase 工具版本:最新(截至 2023 年 9 月 19 日)
  • 节点18

错误信息:

=== Deploying to 'line-shift'...
i  deploying storage, firestore, functions, hosting
i  firebase.storage: checking storage.rules for compilation errors...
✔  firebase.storage: rules file storage.rules compiled successfully
i  firestore: reading indexes from firestore.indexes.json...
i  cloud.firestore: checking firestore.rules for compilation errors...
✔  cloud.firestore: rules file firestore.rules compiled successfully
i  functions: preparing codebase default for deployment
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
i  artifactregistry: ensuring required API artifactregistry.googleapis.com is enabled...
✔  functions: required API cloudbuild.googleapis.com is enabled
✔  functions: required API cloudfunctions.googleapis.com is enabled
✔  artifactregistry: required API artifactregistry.googleapis.com is enabled
i  functions: Loading and analyzing source code for codebase default to determine what to deploy
Serving at port 8875
shutdown requested via /__/quitquitquit
Error: An unexpected error has occurred.

调试信息:

我还使用

--debug
选项运行部署命令以获取更多详细信息。以下是错误发生时的调试日志片段:

... 
[debug] [2023-09-19T01:45:05.303Z] Could not find functions.yaml. Must use http discovery 
[debug] [2023-09-19T01:45:05.307Z] Found firebase-functions binary at '/Users/User2/Desktop/Desktop/LINE-shift/node_modules/.bin/firebase-functions' 
[info] Serving at port 8149 
[debug] [2023-09-19T01:45:05.478Z] Got response from /__/functions.yaml {"endpoints":{"server":{"platform":"gcfv1","availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"serviceAccountEmail":null,"vpc":null,"region":[null],"httpsTrigger":{},"entryPoint":"server"}},"specVersion":"v1alpha1","requiredAPIs":[]} 
[info] shutdown requested via /__/quitquitquit 
[debug] [2023-09-19T01:45:10.643Z] TypeError: Cannot read properties of null (reading 'match') at resolveString (/opt/homebrew/lib/node_modules/firebase-tools/lib/deploy/functions/params.js:31:27) at /opt/homebrew/lib/node_modules/firebase-tools/lib/deploy/functions/params.js:47:36 at Array.map (<anonymous>) at Object.resolveList (/opt/homebrew/lib/node_modules/firebase-tools/lib/deploy/functions/params.js:47:21) at toBackend (/opt/homebrew/lib/node_modules/firebase-tools/lib/deploy/functions/build.js:180:30) at Object.resolveBackend (/opt/homebrew/lib/node_modules/firebase-tools/lib/deploy/functions/build.js:73:23) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async prepare (/opt/homebrew/lib/node_modules/firebase-tools/lib/deploy/functions/prepare.js:68:62) at async chain (/opt/homebrew/lib/node_modules/firebase-tools/lib/deploy/index.js:38:9) at async deploy (/opt/homebrew/lib/node_modules/firebase-tools/lib/deploy/index.js:95:5) 
[error] 
[error] Error: An unexpected error has occurred. 

尽管做出了这些努力,问题仍然存在。我正在寻找有关如何解决此意外错误的指导。有没有人遇到过类似的问题或者可以提供有关这里可能出现问题的见解?

提前感谢您的帮助!

我尝试过的: 将 Firebase 工具更新到最新版本 重新启动我的电脑

javascript typescript firebase deployment nuxtjs3
1个回答
0
投票

我遇到了同样的问题。通过将 Nitro 切换为使用第 2 代 Firebase 功能解决了这个问题。

export default defineNuxtConfig({
  nitro: {
    firebase: {
      gen: 2
    }
  }
})

有关使用 Nitro 部署到 Firebase 的最新文档:https://nitro.unjs.io/deploy/providers/firebase

© www.soinside.com 2019 - 2024. All rights reserved.