Now you should be able to debug using "jdb -connect com.sun.jdi.SocketAttach:
↵
hostname=127.0.0.1,port=8898"
當proxy連接正在運行的函數之後,你可以在VS Code裡面加入新的除錯組態
(在
.vscode/launch.json
檔裡面指定),以連接它打開的本地連接埠。
範例
8-46VS Code
的除錯啟動組態
{
"name": "Attach to Azure Functions on Cloud",
"type": "java",
"request": "attach",
"hostName": "localhost",
"port": 8898
}
現在你可以在VS Code裡面設定斷點,並使用編輯器的除錯面板功能來連接雲端函
數。當你呼叫連接了除錯器的遠端函數之後,即可在本地進行除錯,宛如你在雲端工作
一般。
小結
本章介紹如何妥善地設置本地開發環境,以便在本地組建與測試系統。你已經了解以下
的技術了:
• 使用mock、stub 與服務虛擬化來模擬你可能無法訪問(例如,因為連接或資源上的
原因)的依賴項目。
• 使用Vagrant 之類的工具來實例化一致且可重複建立的VM 以進行本地開發。
• 使用以容器為主的工具,例如minikube 與Telepresence,來建立一致且容易除錯的
環境,以進行本地與遠端開發。
• 使用AWS SAM ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.
O’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
I wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
I’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
I'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.