gpt4 book ai didi

Firebase 云功能部署 - 无效的内存属性

转载 作者:行者123 更新时间:2023-12-05 08:38:33 25 4
gpt4 key购买 nike

我的 firebase 云函数 (TypeScript) 已通过引用官方文档包含了 runtimeOption https://firebase.google.com/docs/functions/manage-functions#set_timeout_and_memory_allocation

const runtimeOpts = {
timeoutSeconds: 540,
memory: "1GB"
}
..
export const GCPSpeech2TranscriptLRR = functions.runWith(runtimeOpts).https.onRequest((req, res) => {

它返回部署错误

src/index.ts:145:58 - error TS2345: Argument of type '{ timeoutSeconds: number; memory: string; }' is not assignable to parameter of type 'RuntimeOptions'.
Types of property 'memory' are incompatible.
Type 'string' is not assignable to type '"128MB" | "256MB" | "512MB" | "1GB" | "2GB" | undefined'.

145 export const GCPSpeech2TranscriptLRR = functions.runWith(runtimeOpts).https.onRequest((req, res) => {

我已经尝试过 memory: "1GB", memory: '1GB' 但我还是遇到同样的错误。如果我删除了“内存:...”行,它将正确部署。即使在 CF 部署成功后,它仍然会在 2 分钟内返回以下错误。据我所知,代码应该运行 9 分钟

Subscriber.js:192 Error: deadline-exceeded
at new HttpsErrorImpl (index.cjs.js:58)
at index.cjs.js:373
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
at push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask (zone.js:503)
at ZoneTask.invoke (zone.js:492)
at timer (zone.js:3034)

最佳答案

这看起来像是 Typescript 编译器推理的问题。尝试:

memory: "1GB" as "1GB"

关于Firebase 云功能部署 - 无效的内存属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62571547/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com