Azure / Azurite

A lightweight server clone of Azure Storage that simulates most of the commands supported by it with minimal dependencies

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Possible TCP port conflict between Azurite and SWA Functions Host (VS Code)

LuKePicci opened this issue · comments

Which service(blob, file, queue, table) does this issue concern?

All

Which version of the Azurite was used?

3.29.0

Where do you get Azurite? (npm, DockerHub, NuGet, Visual Studio Code Extension)

VS Code Extension

What's the Node.js version?

any

What problem was encountered?

starting azurite makes SWA CLI unable to start local functions host, functions host TCP port is busy and unavailable.

[api] Port 7071 is unavailable. Close the process using that port, or specify another port using --port [-p].

Steps to reproduce the issue?

Start Azurite in VS Code and then use "SWA: Run xxxx" action from VS Code Run and Debug panel.

Have you found a mitigation/solution?

If storage is not actually needed for debug, it is enough to Stop azurite, remove local storage emulator setting from local.settings.json and Click Cancel when Storage Account connection setup is prompted.
This is not viable for other projects where Storage Account emulation is needed.

@LuKePicci

Azurite by default listen on port 10000(Blob), 10001(Queue), 10002(Table).
You can change the port by set extension configuration: https://github.com/Azure/Azurite#:~:text=by%20default%20127.0.0.1-,azurite.blobPort,-Blob%20service%20listening

By default Azurite won't occupy port 7071.
And I have tested on my computer, after start Azurite service on VSCode, I still can listen on port 7071 with another program.

So please check if there's any specific configuration/service on your computer which occupied 7071 port.

Nothing else is using port 7071, and as soon as I stop Azurite the error stops appearing. My best guess is that Azurite causes functions host to start twice. I dont know if the second instance is triggered by Azurite itself or by SWA CLI when Azurite is running.

Nothing else is using port 7071, and as soon as I stop Azurite the error stops appearing. My best guess is that Azurite causes functions host to start twice. I dont know if the second instance is triggered by Azurite itself or by SWA CLI when Azurite is running.

The same happens both on Windows and macOS with same VS code, Azurite and swa CLI versions.

I am not familiar with SWA CLI, but I don't think Azurite can cause other function host to start.
It might related with the way you start Azurite and SWA CLI.
Would you please give the detail how you start Azurite in VS code, and how to install SWA CLI and start SWA CLI. And is there any customized configuration on you computer on Azurite of SWA CLI. This might can help the investigation.

I digged into the issue. I confirm Azurite is not the culprit but I confirm this happened only after Azurite is started. The reason is that when Azurite is running VS Code successfully runs one of two conflicting functions host. When Azurite is stopped that same functions host instance fails to start showing a popup error message. Meanwhile the other functions host starts just fine because nothing is conflicting. This happens while the popup message is shown. Clicking debug anyway makes this instance to fail, clicking cancel keeps swa running but VS code is not attached as debugger.

I will open this in swa VS code extension issues.

Thanks for your time.

@LuKePicci

I will close this issue as it looks not caused by Azurite itself, and can't be fixed from Azurite code side.

Feel free to contact us again if need any further assistance on Azurite.