Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure CosmosDB emulator isn't running on localhost. #7039

Closed
3 of 10 tasks
MartinDemberger opened this issue Feb 3, 2023 · 22 comments
Closed
3 of 10 tasks

Azure CosmosDB emulator isn't running on localhost. #7039

MartinDemberger opened this issue Feb 3, 2023 · 22 comments

Comments

@MartinDemberger
Copy link

MartinDemberger commented Feb 3, 2023

Description

Since yesterday our tests which use Azure CosmosDB Emulator on the Agent doesn't run any more.

It seems like the Emulator isn't listening on localhost any more.

In the history of the agent description I see that you upgraded the emulator to a new version.

This broke our complete build and deploy pipeline and we are unable to deploy for almost a day.

Platforms affected

  • Azure DevOps
  • GitHub Actions - Standard Runners
  • GitHub Actions - Larger Runners

Runner images affected

  • Ubuntu 18.04
  • Ubuntu 20.04
  • Ubuntu 22.04
  • macOS 11
  • macOS 12
  • Windows Server 2019
  • Windows Server 2022

Image version and build link

Image: windows-2022
Version: 20230129.1
Included Software: https://github.com/actions/runner-images/blob/win22/20230129.1/images/win/Windows2022-Readme.md
Image Release: https://github.com/actions/runner-images/releases/tag/win22%2F20230129.1

Is it regression?

windows-2022, 20 hours ago.

Expected behavior

Azure CosmosDB-Emulator is listening to localhost.

Actual behavior

Azure CosmosDB-Emulator listenes only to a fixed IP-Address, in my case: 172.25.144.1

Repro steps

Run a pipeline which executes:

Get-Item "$env:ProgramFiles\Azure Cosmos DB Emulator\Microsoft.Azure.Cosmos.Emulator.exe"

This should output the localhost as the listening IP-Address.

@TobiasMorell
Copy link

This issue might be related to Azure/azure-docs-sdk-dotnet#2278, which also started occurring around the same time for me.

@bogdan-damian-bgd
Copy link
Contributor

Hi @MartinDemberger, we'll take a look on it.

@Euan-McVie
Copy link

Euan-McVie commented Feb 3, 2023

This is also an issue on the github hosted windows 2019 runner.
The same issue exists with the emulator downloaded and run locally as per @TobiasMorell's link.
Our devops are looking into adding a step into our pipeline to uninstall/reinstall the downgraded emulator version as a workaround as it is block all our developer and deployment pipelines that use it for running tests before deploying for real to azure.

Note that locally it is running against localhost but is still returning a 500 when attempting to estabalish gremlin websocket
image

@Euan-McVie
Copy link

As a note we have raised a support request directly with MS Azure as per the Emulators Troubleshooting, but as the immediate response is the expected "uninstall and install the older version" what is the Github/MS policy for rolling back a dependency in the runner image until the Azure cosmos team can fix their emulator?

@bogdan-damian-bgd
Copy link
Contributor

bogdan-damian-bgd commented Feb 3, 2023

Hi @MartinDemberger, I guess it may be something in the newer version of the emulator (2.14.11).

However, I tried to make just a simple test in Azure and GH runners (gh workflow sample), by starting emulator like suggested: ... "Start-CosmosDbEmulator -NoFirewall" ... and seems like I was able to get its page/response from localhost:8081 (response).

If you need to test with a previous version (2.14.9), you may try to uninstall current one and take the previous version from choco:
wmic product where "name='Azure Cosmos DB Emulator'" call uninstall /nointeractive
choco install azure-cosmosdb-emulator --version=2.14.9
but it may take some more time.

@dwhieb
Copy link

dwhieb commented Feb 5, 2023

I can confirm I'm getting the same issue. My tests started failing on CI, getting an ECONNREFUSED ::1:8081 error, but I couldn't reproduce the error locally until I upgraded from emulator v2.14.9 to v2.14.11, at which point I immediately got the same error.

Here's the stack trace using v3.17.2 of the @azure/cosmos Node SDK.

     RestError: connect ECONNREFUSED ::1:8081
      at ClientRequest.<anonymous> (node_modules\@azure\core-rest-pipeline\dist\index.js:1701:24)
      at Object.onceWrapper (node:events:628:26)
      at ClientRequest.emit (node:events:513:28)
      at TLSSocket.socketErrorListener (node:_http_client:494:9)
      at TLSSocket.emit (node:events:513:28)
      at emitErrorNT (node:internal/streams/destroy:151:8)
      at emitErrorCloseNT (node:internal/streams/destroy:116:3)
      at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

@TobiasMorell
Copy link

I can confirm that @bogdan-damian-bgd's work around solved the issue for us. The downgrade takes approximately 6 minutes to execute in our build pipeline.

@MartinDemberger
Copy link
Author

I switched our tests to a payed CosmosDB-Instance to be able to work.

This works but it's money my company doesn't want to pay :-(

I hope a fix is available in the near future.

@bogdan-damian-bgd
Copy link
Contributor

@MartinDemberger, could you please provide some more clear repro steps, as the line mentioned in the issue description doesn't seem to be enough?

Also, could you check if the mentioned workaround for downgrading the emulator version works for you?

@MartinDemberger
Copy link
Author

@bogdan-damian-bgd The downgrade works.

What do you need for reproduction?

We have a huge project which uses CosmosDB with Gremlin-API. In the pipelines the tests are running which connects against the local CosmosDB Emulator.
The connection is done with localhost like specified in https://learn.microsoft.com/en-us/azure/cosmos-db/local-emulator?tabs=ssl-netstd21#api-for-gremlin
Since the new version the connections are refused with errorcode 500 (see below for full message)

When I run Get-Item "$env:ProgramFiles\Azure Cosmos DB Emulator\Microsoft.Azure.Cosmos.Emulator.exe" I noticed that CosmosDB isn't listening to localhost.

I can create a new project and pipeline to reproduce this if you need it.


This is the complete stacktrace I see in my tests:

[xUnit.net 00:00:10.67]     RootNine.Persistence.Gremlin.Tests.Samples.TagsTest.TestLinked [FAIL]
  Failed RootNine.Persistence.Gremlin.Tests.Samples.TreeTest.TestNode [8 s]
  Error Message:
   System.AggregateException : One or more errors occurred. (The server returned status code '500' when status code '101' was expected.)
---- System.Net.WebSockets.WebSocketException : The server returned status code '500' when status code '101' was expected.
  Stack Trace:
     at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at Gremlin.Net.Driver.ConnectionPool.FillPoolAsync()
   at Gremlin.Net.Driver.ConnectionPool.ReplaceDeadConnectionsAsync()
   at Gremlin.Net.Process.Utils.WaitUnwrap(Task task)
   at Gremlin.Net.Driver.ConnectionPool..ctor(IConnectionFactory connectionFactory, ConnectionPoolSettings settings)
   at Gremlin.Net.Driver.GremlinClient..ctor(GremlinServer gremlinServer, IMessageSerializer messageSerializer, ConnectionPoolSettings connectionPoolSettings, Action`1 webSocketConfiguration, String sessionId, Boolean disableCompression)
   at ExRam.Gremlinq.Providers.WebSocket.GremlinClientFactory.DefaultGremlinClientFactory.Create(GremlinServer gremlinServer, IMessageSerializer messageSerializer, ConnectionPoolSettings connectionPoolSettings, Action`1 webSocketConfiguration, String sessionId) in /_/src/ExRam.Gremlinq.Providers.WebSocket/GremlinClientFactory.cs:line 11
   at RootNine.Persistence.Gremlin.GremlinConnectionFactory.GremlinClientWithRetryFactory.Create(GremlinServer gremlinServer, IMessageSerializer messageSerializer, ConnectionPoolSettings connectionPoolSettings, Action`1 webSocketConfiguration, String sessionId) in D:\a\1\s\RootNine.Persistence.Gremlin\GremlinConnectionFactory.cs:line 82
   at ExRam.Gremlinq.Providers.WebSocket.WebSocketConfiguratorExtensions.<>c__DisplayClass3_1.<ConfigureMessageSerializer>b__1(GremlinServer server, IMessageSerializer maybeSerializer, ConnectionPoolSettings poolSettings, Action`1 optionsTransformation, String sessionId) in /_/src/ExRam.Gremlinq.Providers.WebSocket/Extensions/WebSocketConfiguratorExtensions.cs:line 18
   at ExRam.Gremlinq.Providers.WebSocket.GremlinClientFactory.FuncGremlinClientFactory.Create(GremlinServer gremlinServer, IMessageSerializer messageSerializer, ConnectionPoolSettings connectionPoolSettings, Action`1 webSocketConfiguration, String sessionId) in /_/src/ExRam.Gremlinq.Providers.WebSocket/GremlinClientFactory.cs:line 28
   at ExRam.Gremlinq.Core.ConfigurableGremlinQuerySourceExtensions.WebSocketGremlinQueryExecutor.<>c__DisplayClass3_0.<.ctor>b__1() in /_/src/ExRam.Gremlinq.Providers.WebSocket/Extensions/ConfigurableGremlinQuerySourceExtensions.cs:line 38
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at ExRam.Gremlinq.Core.ConfigurableGremlinQuerySourceExtensions.WebSocketGremlinQueryExecutor.<>c__DisplayClass3_0.<<-ctor>b__0>d.MoveNext() in /_/src/ExRam.Gremlinq.Providers.WebSocket/Extensions/ConfigurableGremlinQuerySourceExtensions.cs:line 38
--- End of stack trace from previous location ---
   at ExRam.Gremlinq.Core.SmarterLazy`1.GetValue(ILogger logger)
   at ExRam.Gremlinq.Core.ConfigurableGremlinQuerySourceExtensions.WebSocketGremlinQueryExecutor.<>c__DisplayClass5_0.<<Execute>g__Core|0>d.MoveNext() in /_/src/ExRam.Gremlinq.Providers.WebSocket/Extensions/ConfigurableGremlinQuerySourceExtensions.cs:line 92
--- End of stack trace from previous location ---
   at ExRam.Gremlinq.Core.ConfigurableGremlinQuerySourceExtensions.WebSocketGremlinQueryExecutor.<>c__DisplayClass5_0.<<Execute>g__Core|0>d.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult(Int16 token)
   at ExRam.Gremlinq.Core.Execution.GremlinQueryExecutorExtensions.LoggingGremlinQueryExecutor.<>c__DisplayClass3_0.<<Execute>g__Core|0>d.MoveNext() in /_/src/ExRam.Gremlinq.Core/Extensions/GremlinQueryExecutorExtensions.cs:line 107
--- End of stack trace from previous location ---
   at ExRam.Gremlinq.Core.Execution.GremlinQueryExecutorExtensions.LoggingGremlinQueryExecutor.<>c__DisplayClass3_0.<<Execute>g__Core|0>d.MoveNext() in /_/src/ExRam.Gremlinq.Core/Extensions/GremlinQueryExecutorExtensions.cs:line 120
--- End of stack trace from previous location ---
   at ExRam.Gremlinq.Core.Execution.GremlinQueryExecutorExtensions.LoggingGremlinQueryExecutor.<>c__DisplayClass3_0.<<Execute>g__Core|0>d.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult(Int16 token)
   at System.Linq.AsyncEnumerable.SelectManyAsyncIterator`2.ToListAsync(CancellationToken cancellationToken) in /_/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/SelectMany.cs:line 432
   at System.Linq.AsyncEnumerable.SelectManyAsyncIterator`2.ToListAsync(CancellationToken cancellationToken) in /_/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/SelectMany.cs:line 432
   at System.Linq.AsyncEnumerable.SelectManyAsyncIterator`2.ToArrayAsync(CancellationToken cancellationToken) in /_/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/SelectMany.cs:line 423
   at ExRam.Gremlinq.Core.GremlinQueryAwaiter`1.GetResult() in /_/src/ExRam.Gremlinq.Core/Queries/GremlinQueryAwaiter.cs:line 18
   at RootNine.Persistence.Gremlin.Tests.TestPersistenceAccessor.CreateTreeNode(String name, Nullable`1 parent, Nullable`1 predecessor) in D:\a\1\s\RootNine.Persistence.Gremlin.Tests\TestPersistenceAccessor.cs:line 73
   at RootNine.Persistence.Gremlin.Tests.Samples.TreeTest.TestNode() in D:\a\1\s\RootNine.Persistence.Gremlin.Tests\TreeTest.cs:line 54
--- End of stack trace from previous location ---
----- Inner Stack Trace -----
   at System.Net.WebSockets.WebSocketHandle.ConnectAsync(Uri uri, CancellationToken cancellationToken, ClientWebSocketOptions options)
   at System.Net.WebSockets.ClientWebSocket.ConnectAsyncCore(Uri uri, CancellationToken cancellationToken)
   at Gremlin.Net.Driver.WebSocketConnection.ConnectAsync(Uri uri, CancellationToken cancellationToken)
   at Gremlin.Net.Driver.Connection.ConnectAsync(CancellationToken cancellationToken)
   at Gremlin.Net.Driver.ConnectionPool.CreateNewConnectionAsync()
   at Gremlin.Net.Driver.ConnectionPool.FillPoolAsync()
  Failed RootNine.Persistence.Gremlin.Tests.Samples.TagsTest.TestLinked [8 s]
  Error Message:
   System.AggregateException : One or more errors occurred. (The server returned status code '500' when status code '101' was expected.)
---- System.Net.WebSockets.WebSocketException : The server returned status code '500' when status code '101' was expected.
  Stack Trace:
     at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at Gremlin.Net.Driver.ConnectionPool.FillPoolAsync()
   at Gremlin.Net.Driver.ConnectionPool.ReplaceDeadConnectionsAsync()
   at Gremlin.Net.Process.Utils.WaitUnwrap(Task task)
   at Gremlin.Net.Driver.ConnectionPool..ctor(IConnectionFactory connectionFactory, ConnectionPoolSettings settings)
   at Gremlin.Net.Driver.GremlinClient..ctor(GremlinServer gremlinServer, IMessageSerializer messageSerializer, ConnectionPoolSettings connectionPoolSettings, Action`1 webSocketConfiguration, String sessionId, Boolean disableCompression)
   at ExRam.Gremlinq.Providers.WebSocket.GremlinClientFactory.DefaultGremlinClientFactory.Create(GremlinServer gremlinServer, IMessageSerializer messageSerializer, ConnectionPoolSettings connectionPoolSettings, Action`1 webSocketConfiguration, String sessionId) in /_/src/ExRam.Gremlinq.Providers.WebSocket/GremlinClientFactory.cs:line 11
   at RootNine.Persistence.Gremlin.GremlinConnectionFactory.GremlinClientWithRetryFactory.Create(GremlinServer gremlinServer, IMessageSerializer messageSerializer, ConnectionPoolSettings connectionPoolSettings, Action`1 webSocketConfiguration, String sessionId) in D:\a\1\s\RootNine.Persistence.Gremlin\GremlinConnectionFactory.cs:line 82
   at ExRam.Gremlinq.Providers.WebSocket.WebSocketConfiguratorExtensions.<>c__DisplayClass3_1.<ConfigureMessageSerializer>b__1(GremlinServer server, IMessageSerializer maybeSerializer, ConnectionPoolSettings poolSettings, Action`1 optionsTransformation, String sessionId) in /_/src/ExRam.Gremlinq.Providers.WebSocket/Extensions/WebSocketConfiguratorExtensions.cs:line 18
   at ExRam.Gremlinq.Providers.WebSocket.GremlinClientFactory.FuncGremlinClientFactory.Create(GremlinServer gremlinServer, IMessageSerializer messageSerializer, ConnectionPoolSettings connectionPoolSettings, Action`1 webSocketConfiguration, String sessionId) in /_/src/ExRam.Gremlinq.Providers.WebSocket/GremlinClientFactory.cs:line 28
   at ExRam.Gremlinq.Core.ConfigurableGremlinQuerySourceExtensions.WebSocketGremlinQueryExecutor.<>c__DisplayClass3_0.<.ctor>b__1() in /_/src/ExRam.Gremlinq.Providers.WebSocket/Extensions/ConfigurableGremlinQuerySourceExtensions.cs:line 38
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at ExRam.Gremlinq.Core.ConfigurableGremlinQuerySourceExtensions.WebSocketGremlinQueryExecutor.<>c__DisplayClass3_0.<<-ctor>b__0>d.MoveNext() in /_/src/ExRam.Gremlinq.Providers.WebSocket/Extensions/ConfigurableGremlinQuerySourceExtensions.cs:line 38
--- End of stack trace from previous location ---
   at ExRam.Gremlinq.Core.SmarterLazy`1.GetValue(ILogger logger)
   at ExRam.Gremlinq.Core.ConfigurableGremlinQuerySourceExtensions.WebSocketGremlinQueryExecutor.<>c__DisplayClass5_0.<<Execute>g__Core|0>d.MoveNext() in /_/src/ExRam.Gremlinq.Providers.WebSocket/Extensions/ConfigurableGremlinQuerySourceExtensions.cs:line 92
--- End of stack trace from previous location ---
   at ExRam.Gremlinq.Core.ConfigurableGremlinQuerySourceExtensions.WebSocketGremlinQueryExecutor.<>c__DisplayClass5_0.<<Execute>g__Core|0>d.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult(Int16 token)
   at ExRam.Gremlinq.Core.Execution.GremlinQueryExecutorExtensions.LoggingGremlinQueryExecutor.<>c__DisplayClass3_0.<<Execute>g__Core|0>d.MoveNext() in /_/src/ExRam.Gremlinq.Core/Extensions/GremlinQueryExecutorExtensions.cs:line 107
--- End of stack trace from previous location ---
   at ExRam.Gremlinq.Core.Execution.GremlinQueryExecutorExtensions.LoggingGremlinQueryExecutor.<>c__DisplayClass3_0.<<Execute>g__Core|0>d.MoveNext() in /_/src/ExRam.Gremlinq.Core/Extensions/GremlinQueryExecutorExtensions.cs:line 120
--- End of stack trace from previous location ---
   at ExRam.Gremlinq.Core.Execution.GremlinQueryExecutorExtensions.LoggingGremlinQueryExecutor.<>c__DisplayClass3_0.<<Execute>g__Core|0>d.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult(Int16 token)
   at System.Linq.AsyncEnumerable.SelectManyAsyncIterator`2.MoveNextCore() in /_/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/SelectMany.cs:line 456
   at System.Linq.AsyncIteratorBase`1.MoveNextAsync() in /_/Ix.NET/Source/System.Linq.Async/System/Linq/AsyncIterator.cs:line 70
   at System.Linq.AsyncIteratorBase`1.MoveNextAsync() in /_/Ix.NET/Source/System.Linq.Async/System/Linq/AsyncIterator.cs:line 75
   at System.Linq.AsyncEnumerable.<SingleAsync>g__Core|530_0[TSource](IAsyncEnumerable`1 source, CancellationToken cancellationToken) in /_/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Single.cs:line 43
   at System.Linq.AsyncEnumerable.<SingleAsync>g__Core|530_0[TSource](IAsyncEnumerable`1 source, CancellationToken cancellationToken) in /_/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Single.cs:line 55
   at RootNine.Persistence.Gremlin.Tests.TestPersistenceAccessor.CreateInquiry(InquiryEntity inquiryEntity) in D:\a\1\s\RootNine.Persistence.Gremlin.Tests\TestPersistenceAccessor.cs:line 345
   at RootNine.Persistence.Gremlin.Tests.Samples.TagsTest.TestLinked() in D:\a\1\s\RootNine.Persistence.Gremlin.Tests\TagsTest.cs:line 88
--- End of stack trace from previous location ---
----- Inner Stack Trace -----
   at System.Net.WebSockets.WebSocketHandle.ConnectAsync(Uri uri, CancellationToken cancellationToken, ClientWebSocketOptions options)
   at System.Net.WebSockets.ClientWebSocket.ConnectAsyncCore(Uri uri, CancellationToken cancellationToken)
   at Gremlin.Net.Driver.WebSocketConnection.ConnectAsync(Uri uri, CancellationToken cancellationToken)
   at Gremlin.Net.Driver.Connection.ConnectAsync(CancellationToken cancellationToken)
   at Gremlin.Net.Driver.ConnectionPool.CreateNewConnectionAsync()
   at Gremlin.Net.Driver.ConnectionPool.FillPoolAsync()

@bogdan-damian-bgd
Copy link
Contributor

@MartinDemberger, It is almost obvious that the problem may come with the latest version of the emulator (2.14.11) and I would raise an issue with its support team. However, the basic tests I mentioned previously (getting a response from localhost:8081) seems to pass Ok. Also, the repro line you suggested (Get-Item...) seems incomplete or without proper context.
So, some clear repro steps would be appreciated to try and raise the issue with the emulator support.

@bogdan-damian-bgd
Copy link
Contributor

@TobiasMorell, @dwhieb - this modified workaround seems to be pretty quicker than the previous one suggested:

  Import-Module "$env:ProgramFiles\Azure Cosmos DB Emulator\PSModules\Microsoft.Azure.CosmosDB.Emulator"
  Uninstall-CosmosDbEmulator
  choco install azure-cosmosdb-emulator --version=2.14.9

@dwhieb
Copy link

dwhieb commented Feb 7, 2023

@bogdan-damian-bgd That workaround works great. Thanks for the quicker version!

@MartinDemberger
Copy link
Author

@MartinDemberger, It is almost obvious that the problem may come with the latest version of the emulator (2.14.11) and I would raise an issue with its support team. However, the basic tests I mentioned previously (getting a response from localhost:8081) seems to pass Ok. Also, the repro line you suggested (Get-Item...) seems incomplete or without proper context. So, some clear repro steps would be appreciated to try and raise the issue with the emulator support.

@bogdan-damian-bgd You are right. Sorry. The command doesn't have any helpful output. This is a copy and paste error which I reproduced in my answer.

The complete script was

$Emulator = Get-Item "$env:ProgramFiles\Azure Cosmos DB Emulator\Microsoft.Azure.Cosmos.Emulator.exe"
$IPAddress = Get-NetIPAddress -AddressFamily IPV4 -AddressState Preferred -PrefixOrigin Manual | Select-Object IPAddress

New-Object PSObject @{
  Emulator = $Emulator.BaseName
  Version = $Emulator.VersionInfo.ProductVersion
  Endpoint = @($(hostname), $IPAddress.IPAddress) | ForEach-Object { "https://${_}:8081/" }
  MongoDBEndpoint = @($(hostname), $IPAddress.IPAddress) | ForEach-Object { "mongodb://${_}:10255/" }
  CassandraEndpoint = @($(hostname), $IPAddress.IPAddress) | ForEach-Object { "tcp://${_}:10350/" }
  GremlinEndpoint = @($(hostname), $IPAddress.IPAddress) | ForEach-Object { "http://${_}:8901/" }
  TableEndpoint = @($(hostname), $IPAddress.IPAddress) | ForEach-Object { "https://${_}:8902/" }
  IPAddress = $IPAddress.IPAddress
}

My original suggestion about not listening to the IP was completely nonsense because it answers with 500 which means it is listening. And my script shows the local IPs and not the IP the emulator is listening.

So sorry again. My description was a result of the stress and anger about the situation. Our complete development was blocked without any guess what we did wrong and how to solve it.

danielcweber added a commit to Gremlinq/ExRam.Gremlinq that referenced this issue Feb 14, 2023
@danielcweber
Copy link

danielcweber commented Feb 14, 2023

Thanks @bogdan-damian-bgd, here's the workaround ready to be copy-pasted into a Github action.

@kaito-ms
Copy link

This issue is resolved in Azure Cosmos DB Emulator v2.14.12. I have created an issue for tool update.
Update [Azure Cosmos DB Emulator] · Issue #7327 · actions/runner-images

@mikhailkoliada
Copy link
Contributor

Deployed, please test it! If something is broken feel free to reach us again.

@RasKrog
Copy link

RasKrog commented Mar 31, 2023

Tried to use the latest version, and it works again!

@hyecheol123
Copy link

I am still getting the same issue, and I used the commands from this thread.

I checked I am using the latest version of Cosmos DB Emulator, but still get the same error.

Here is the script I used to setup Cosmos DB Emulator, and the output from it.

Write-Host "Launching Cosmos DB Emulator"
  Import-Module "$env:ProgramFiles\Azure Cosmos DB Emulator\PSModules\Microsoft.Azure.CosmosDB.Emulator"
  
  $startEmulatorCmd = "Start-CosmosDbEmulator -NoFirewall -NoUI"
  Write-Host $startEmulatorCmd
  Invoke-Expression -Command $startEmulatorCmd
  
  # Pipe an emulator info object to the output stream
  
  $Emulator = Get-Item "$env:ProgramFiles\Azure Cosmos DB Emulator\Microsoft.Azure.Cosmos.Emulator.exe"
  $IPAddress = Get-NetIPAddress -AddressFamily IPV4 -AddressState Preferred -PrefixOrigin Manual | Select-Object IPAddress
  
  New-Object PSObject @{
    Emulator = $Emulator.BaseName
    Version = $Emulator.VersionInfo.ProductVersion
    Endpoint = @($(hostname), $IPAddress.IPAddress) | ForEach-Object { "https://${_}:8081/" }
    MongoDBEndpoint = @($(hostname), $IPAddress.IPAddress) | ForEach-Object { "mongodb://${_}:10255/" }
    CassandraEndpoint = @($(hostname), $IPAddress.IPAddress) | ForEach-Object { "tcp://${_}:10[35](https://github.com/hyecheol123/Collegemate-Miscellaneous-API/actions/runs/5095855854/jobs/9161237090#step:3:35)0/" }
    GremlinEndpoint = @($(hostname), $IPAddress.IPAddress) | ForEach-Object { "http://${_}:8901/" }
    TableEndpoint = @($(hostname), $IPAddress.IPAddress) | ForEach-Object { "https://${_}:8902/" }
    IPAddress = $IPAddress.IPAddress
Launching Cosmos DB Emulator
Start-CosmosDbEmulator -NoFirewall -NoUI

Name                           Value
----                           -----
GremlinEndpoint                {http://fv-az479-[27](https://github.com/hyecheol123/Collegemate-Miscellaneous-API/actions/runs/5095855854/jobs/9161237090#step:3:28)5:8901/, [http://172.22.208.1:8901/}](http://172.22.208.1:8901/%7D)
IPAddress                      172.22.208.1
Emulator                       Microsoft.Azure.Cosmos.Emulator
Version                        2.14.12.0
MongoDBEndpoint                {mongodb://fv-az479-275:10255/, mongodb://172.22.208.1:10255/}
CassandraEndpoint              {tcp://fv-az479-275:10[35](https://github.com/hyecheol123/Collegemate-Miscellaneous-API/actions/runs/5095855854/jobs/9161237090#step:3:36)0/, tcp://172.22.208.1:10350/}
Endpoint                       {https://fv-az479-275:8081/, [https://172.22.208.1:8081/}](https://172.22.208.1:8081/%7D)
TableEndpoint                  {https://fv-az479-275:8902/, [https://172.22.208.1:8902/}](https://172.22.208.1:8902/%7D)

From the application, I am getting RestError: connect ECONNREFUSED ::1:8081, while using Node SDK.

@hyecheol123
Copy link

If I hardcode 127.0.0.1:8081, not localhost:8081, then it works. It might because the Emulator is not exposed to IPV6 localhost, while the default localhost for the GitHub action Windows runner uses IPV4?

@alexandrereyes
Copy link

I downgraded to 2.14.4, this solved the problem.
To install previous versions, use chocolatey:
https://community.chocolatey.org/packages/azure-cosmosdb-emulator/2.14.4#versionhistory

@kylekirkby
Copy link

If I hardcode 127.0.0.1:8081, not localhost:8081, then it works. It might because the Emulator is not exposed to IPV6 localhost, while the default localhost for the GitHub action Windows runner uses IPV4?

This fixed my issue too. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests