Intellij Idea IntelliJ调试器已连接到Firebase本地仿真器,但未在断点处停止

0md85ypi  于 2023-04-05  发布在  其他
关注(0)|答案(1)|浏览(127)

我已经断断续续地写了好几天了,通读并跟踪了我能找到的关于这个主题的所有线索,但仍然不能让它起作用。
我正在尝试在IntelliJ IDE中本地调试Firebase函数。下面是start命令的输出。

**firebase emulators:start --inspect-functions**

> bear@paw:~/dev/test-cloud-functions$ firebase emulators:start --inspect-functions \
> i  emulators: Starting emulators: functions, firestore\
> ⚠  functions: You are running the Functions emulator in debug mode (port=9229). This means that functions will execute in sequence rather than in parallel.\
> ⚠  functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: auth, database, hosting, pubsub, storage\
> i  firestore: Firestore Emulator logging to firestore-debug.log\
> ✔  firestore: Firestore Emulator UI websocket is running on 9150.\
> i  ui: Emulator UI logging to ui-debug.log \
> i  functions: Watching "/home/bear/dev/test-cloud-functions/functions" for Cloud Functions...\
> ✔  functions: Using node@16 from host.\
> ✔  functions: Loaded functions definitions from source: .\
>  Debugger listening on ws://127.0.0.1:9229/8aef43e5-94cb-4d79-b178-92db4ba380c9
>  For help, see: https://nodejs.org/en/docs/inspector
> i  functions: Watching "/home/bear/dev/test-cloud-functions/mod" for Cloud Functions...
> ✔  functions: Using node@16 from host.\
> ✔  functions: Loaded functions definitions from source: processTransaction, testFunction.\
> ✔  functions[europe-west1-processTransaction]: firestore function initialized.\
> ✔  functions[europe-west1-testFunction]: http function initialized (http://127.0.0.1:5001/testproject/europe-west1/testFunction).\
>  Starting inspector on 127.0.0.1:9229 failed: address already in use
>
>┌─────────────────────────────────────────────────────────────┐
>│ ✔  All emulators ready! It is now safe to connect your app. │
>│ i  View Emulator UI at http://127.0.0.1:4000/               │
>└─────────────────────────────────────────────────────────────┘
>
>┌───────────┬────────────────┬─────────────────────────────────┐
>│ Emulator  │ Host:Port      │ View in Emulator UI             │
>├───────────┼────────────────┼─────────────────────────────────┤
>│ Functions │ 127.0.0.1:5001 │ http://127.0.0.1:4000/functions │
>├───────────┼────────────────┼─────────────────────────────────┤
>│ Firestore │ 127.0.0.1:8080 │ http://127.0.0.1:4000/firestore │
>└───────────┴────────────────┴─────────────────────────────────┘
>  Emulator Hub running at 127.0.0.1:4400\
>  Other reserved ports: 4500, 9150\
>
>Issues? Report them at https://github.com/firebase/firebase-tools/issues and attach the *-debug.log files.\
> 
>  Debugger attached.\  
>  Checking ip address\
>  Outbound IP address is: 124.120.192.159\

> ✔  functions: Using node@16 from host.\
> ✔  functions: Loaded functions definitions from source: processTransaction, testFunction.\
>  Starting inspector on 127.0.0.1:9229 failed: address already in use\
> ✔  functions: Using node@16 from host.\
> ✔  functions: Loaded functions definitions from source: processTransaction, testFunction.\
>  Starting inspector on 127.0.0.1:9229 failed: address already in use\
>  Checking ip address\
>  Outbound IP address is: 124.120.192.159\
>  Debugger ending on ws://127.0.0.1:9229/8aef43e5-94cb-4d79-b178-92db4ba380c9\
>  For help, see: https://nodejs.org/en/docs/inspector\
>  Debugger attached.

调试器配置被设置为连接到Chrome/Node的端口9229上,并且似乎工作正常。但是,当我设置断点并通过打开浏览器到http://127.0.0.1:5001/test-project/europe-west1/testFunction调用testFunction时,函数运行并显示其外部IP地址的输出,而不会在断点处停止。是否有特殊的方法来调用Firebase模拟器函数以调用调试器?我错过了什么?请帮帮我。

hec6srdp

hec6srdp1#

https://medium.com/@david_shortman/build-and-debug-firebase-functions-in-vscode-73efb76166cf,* 在Javascript中从网页使用Firebase函数 * 一节中,我可以看到这样的函数必须以不同的方式进行调试;您可能需要使用JavaScript Debug运行配置(请参阅页面底部的 Debugging a Webpage with Chrome debugger)。但我自己没有尝试过。您可以检查一下是否可以在Chrome Dev Tools中调试您的函数吗?如果可以,那么使用JavaScript Debug运行配置进行调试也应该可以
我还建议在Firebase Google Group上提问

相关问题