microsoft / vscode-cosmosdb

Azure Databases extension for VS Code
https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-cosmosdb
MIT License
155 stars 68 forks source link

Fail to create a database for PostgreSQL server #2180

Closed v-ruizh closed 7 months ago

v-ruizh commented 12 months ago

OS: Win10 Build Version: 20230919.6

Repro Steps:

  1. Create one PostgreSQL server in VS Code.
  2. Expand the above single server -> Expand "postgre" database -> Connect to this server.
  3. Right click the PostgreSQL server -> Select "Create Database..." -> Enter a database name to create.
  4. Check whether succeeds to create a database or not.

Expect: Succeed to create a database for PostgreSQL server without any error.

Actual: Fail to create a database for PostgreSQL server with an error. image

More Info: This issue reproduces for both single and flexible PostgreSQL server.

v-ruizh commented 11 months ago

Verified this bug on a newer build 20230927.1, the error message changes. You can get the details from below. The below error shows when creating a new database for Single PostgreSQL server. image The below error shows when creating a new database for Flexible PostgreSQL server. image

JasonYeMSFT commented 11 months ago

I believe this has been fixed.

v-ruizh commented 11 months ago

Verified this bug on the latest build 20231017.2, this issue also reproduces. You can get the details from below. The below error shows when creating a new database for Single PostgreSQL server. image The below error shows when creating a new database for Flexible PostgreSQL server. image

HaydenBussard commented 8 months ago

I believe this has been fixed.

I am still getting this. My copy of MS Code is up to date. Azure extension installed a day or two ago.

JasonYeMSFT commented 8 months ago

I am still not able to reproduce this problem. The "ECONNRESET" error hints that it might have something to do with a transient network issue. If you can ever reproduce this issue, could you go to the Output panel in VSCode and get the output from the extension like my screenshot shows? It would help further investigate the issue if I can know which stage failed.

image
v-ruizh commented 8 months ago

@JasonYeMSFT Verified this issue on the current released Azure Databases extension v0.20.0, this issue also reproduces. The repro steps and output show as below.

  1. Create a PostgreSQL server.
  2. Add the firewall rule to connect to the "postgre" database.
  3. Create a new database for this PostgreSQL server. image

Can't verify this issue on the latest main branch build 20240109.2 due to the known bug https://github.com/microsoft/vscode-cosmosdb/issues/2209.

JasonYeMSFT commented 8 months ago

OK. It seems like the datebase creation was successful but the follow up access didn't work. Could you go to Azure Portal, navigate to the postgres database resource > Networking blade and see if the current IP detected by Azure Portal matches the IP address printed in the output? The IP detection logic we use may not guarantee that the IP address we add to the firewall rule is the actual IP address used to connect to the database.

Screenshot 2024-01-11 at 11 53 59 AM
v-ruizh commented 8 months ago

Checked the current IP in Azure Portal, the current IP detected by Azure Portal matches the IP address printed in the output.

JasonYeMSFT commented 8 months ago

OK, however, unfortunately there is no way for us nor Portal to guarantee the IP address we detect will be used to connect. For everyone who encounters the ECONNRESET error, please consult your local network admin to see if they can help you figure out at which stage does the network reset happens.

JasonYeMSFT commented 7 months ago

I found a bug while looking into #2224. I am going to close this issue since it is more related to the firewall setting.