gpt4 book ai didi

Firebase服务附加调试器与VS Code

转载 作者:行者123 更新时间:2023-12-04 16:13:44 24 4
gpt4 key购买 nike

我正在使用firebase serve --only functions,hosting命令在本地运行模拟器。这很好。但是,我想采取进一步的措施,并希望在附加调试器的情况下在本地调试我的函数。网址示例:http://localhost:5001/foo-project/us-central1/helloWorld

有可能这样做吗?

如何构建launch.json将调试器附加到我的函数中?

   {
"type": "node",
"request": "attach",
"name": "Attach",
"port": 9229
}

最佳答案

像这样设置您的launch.json:

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/functions/index.js",
"env": { "FIREBASE_CONFIG": "{\"databaseURL\":\"https://XXXXX-2d371.firebaseio.com\",\"storageBucket\":\"XXXXX-2d371.appspot.com\",\"projectId\":\"XXXX-2d371\"}"}
}
]
}

确保将“程序”设置为functions目录的起点。

关于Firebase服务附加调试器与VS Code,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49567724/

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