handleMessage:RangeError:超出了最大调用堆栈大小



我在firebase函数项目中使用了'kotlinx序列化运行时js'。到目前为止一切都如预期的那样进行。但由于我使用:

val js = kotlinx.serialization.json.Json(JsonConfiguration.Stable)
             .kotlinx.serialization.stringify(result)

我无法在函数模拟器中本地运行它。启动时,它显示在日志中:

Error in handleMessage: {"frb":{"cwd":"/home/drindt/.../functions","projectId":"c*******r-d*********t","triggerId":"","emulators":{},"socketPath":"/tmp/fire_emu_144610.sock"},"opts":{"nodeBinary":"/usr/bin/node","env":{"GOOGLE_APPLICATION_CREDENTIALS":"/home/drindt/.config/firebase/credentials.json"}}} => RangeError: Maximum call stack size exceeded: RangeError: Maximum call stack size exceeded
at extractTriggers (/home/drindt/.npm-packages/lib/node_modules/firebase-tools/lib/extractTriggers.js:2:32)

extractTriggers的递归调用导致了该问题。我在另一个文件中发现,当这个错误发生时,是因为导出了其他模块,而不仅仅是功能模块。我查看了kotlin编译的js文件,确认了这一点。如果我从上面删除字符串,一切都会正常工作。如果我能得到一些帮助来解决这个问题,那就太好了。感谢您花时间阅读并帮助我。

我在这里遇到了同样的问题,由于我还不能发表评论(声誉不够(,我在这里发布了我的问题和解决方案:

简而言之,给我上了一课

除了函数之外,不要在index.ts中使用export const

所以对我来说,它显示了以下错误:

functions: Maximum call stack size exceeded
function was killed because it raised an unhandled error.

当我查看firebase-debug.log文件时,我发现错误源于extractTriggers.js,它位于:

/Users/$name$/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/extractTriggers.js

但我仍然不知道根本原因是什么,所以我使用console.log打印出在extractTriggers.js:中调用的函数名

i  firestore: Firestore Emulator logging to firestore-debug.log
i  ui: Emulator UI logging to ui-debug.log
i  functions: Watching "/Users/****/Desktop/.../firebase-cloud-functions/functions" for Cloud Functions...
>  ExtractTriggers for function options
>  ExtractTriggers for function allowedHeaders
>  ExtractTriggers for function 0
>  ExtractTriggers for function 1
>  ExtractTriggers for function 2
>  ExtractTriggers for function credentials
>  ExtractTriggers for function methods
>  ExtractTriggers for function origin
>  ExtractTriggers for function preflightContinue
>  ExtractTriggers for function firebaseAdmin
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
>  ExtractTriggers for function Promise
>  ExtractTriggers for function INTERNAL
>  ExtractTriggers for function firebase_
>  ExtractTriggers for function __esModule
>  ExtractTriggers for function credential
>  ExtractTriggers for function cert
>  ExtractTriggers for function refreshToken
>  ExtractTriggers for function applicationDefault
>  ExtractTriggers for function SDK_VERSION
⚠  functions: Maximum call stack size exceeded
⚠  Your function was killed because it raised an unhandled error.

当仔细观察时,我发现重复开始于函数名firebaseAdmin之后。我已经在我的index.ts 中导出了firebase管理实例

import * as admin from 'firebase-admin';
//...
export const firebaseAdmin = admin;

这就是这一切的根本原因,只需删除那一行,并在所有其他文件中使用单独的导入就对我有效了!

相关内容

  • 没有找到相关文章

最新更新