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

Running Azurite with custom port using docker compose #2384

Open
wayne-w-cloud opened this issue Apr 2, 2024 · 4 comments
Open

Running Azurite with custom port using docker compose #2384

wayne-w-cloud opened this issue Apr 2, 2024 · 4 comments
Assignees
Labels
blob-storage question Further information is requested

Comments

@wayne-w-cloud
Copy link

wayne-w-cloud commented Apr 2, 2024

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

blob

Which version of the Azurite was used?

latest

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

Docker hub

What's the Node.js version?

What problem was encountered?

I am trying to run azurite with azure function python using custom port via docker compose. I was able to use the custom port to start the azurite and having storage explorer connect to it. I am having issue to start the function.

Steps to reproduce the issue?

My docker compose file looks like

  azurite:
    image: mcr.microsoft.com/azure-storage/azurite
    container_name: azurite
    hostname: azurite
    command: azurite --blobHost 0.0.0.0 --blobPort 9310 --queueHost 0.0.0.0 --queuePort 9311 --tableHost 0.0.0.0 --tablePort 9312 --location /data --debug /data/debug.log --skipApiVersionCheck --loose
    ports:
      - 9310:9310
      - 9311:9311
      - 9312:9312
    restart: "always"
    volumes:
      - ./azurite-data:/workspace
    networks:
      - web

My connection string is

AzureWebJobsStorage=DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azurite:9310/devstoreaccount1;QueueEndpoint=http://azurite:9311/devstoreaccount1;TableEndpoint=http://azurite:9312/devstoreaccount1

If possible, please provide the debug log using the -d parameter, replacing <pathtodebuglog> with an appropriate path for your OS, or review the instructions for docker containers:

Blob triggered function failed to start
     ---> Azure.RequestFailedException: Service request failed.
    Status: 400 (Bad Request)
    Headers:
     Server: Azurite-Blob/3.29.0
     Date: Tue, 02 Apr 2024 22:38:13 GMT
     Connection: keep-alive
     Keep-Alive: REDACTED
      Content-Length: 0
      
   at Azure.Storage.Blobs.ContainerRestClient.CreateAsync(Nullable`1 timeout, IDictionary`2 metadata, Nullable`1 access, String defaultEncryptionScope, Nullable`1 preventEncryptionScopeOverride, CancellationToken cancellationToken)
   at Azure.Storage.Blobs.BlobContainerClient.CreateInternal(PublicAccessType publicAccessType, IDictionary`2 metadata, BlobContainerEncryptionScopeOptions encryptionScopeOptions, Boolean async, CancellationToken cancellationToken, String operationName)

Please be sure to remove any PII or sensitive information before sharing!
The debug log will log raw request headers and bodies, so that we can replay these against Azurite using REST and create tests to validate resolution.

Have you found a mitigation/solution?

@EmmaZhu
Copy link
Collaborator

EmmaZhu commented Apr 3, 2024

Hi @wayne-w-cloud ,

With 400 error returned, seems you have successfully connected to Azurite, which means customized port should not be the root cause for the error.

Could you share Azurite's debug log? With the log, we'd be able to see why the 400 happens.

@wayne-w-cloud
Copy link
Author

Here is my log. Thanks!

azurite                 | 192.168.65.1 - - [03/Apr/2024:11:57:05 +0000] "GET /devstoreaccount1/container/?restype=service&comp=properties HTTP/1.1" 400 -
   | fail: Host.Startup[515]
   |       A host error has occurred during startup operation '7628d72d-14a4-4aef-8c12-42f7d3987340'.
   |       Azure.RequestFailedException: Service request failed.
   |       Status: 400 (Bad Request)
   |
   |       Headers:
   |       Server: Azurite-Blob/3.29.0
   |       Date: Wed, 03 Apr 2024 11:57:05 GMT
   |       Connection: keep-alive
   |       Keep-Alive: REDACTED
   |       Content-Length: 0
   |
   |          at Azure.Storage.Blobs.ServiceRestClient.GetPropertiesAsync(Nullable`1 timeout, CancellationToken cancellationToken)
   |          at Azure.Storage.Blobs.BlobServiceClient.GetPropertiesInternal(Boolean async, CancellationToken cancellationToken)
   |          at Azure.Storage.Blobs.BlobServiceClient.GetPropertiesAsync(CancellationToken cancellationToken)
   |          at Microsoft.Azure.WebJobs.Extensions.Storage.Blobs.Listeners.BlobLogListener.EnableLoggingAsync(BlobServiceClient blobClient, CancellationToken cancellationToken)
   |          at Microsoft.Azure.WebJobs.Extensions.Storage.Blobs.Listeners.BlobLogListener.CreateAsync(BlobServiceClient blobClient, ILogger`1 logger, CancellationToken cancellationToken)
   |          at Microsoft.Azure.WebJobs.Extensions.Storage.Blobs.Listeners.PollLogsStrategy.RegisterAsync(BlobServiceClient blobServiceClient, BlobContainerClient container, ITriggerExecutor`1 triggerExecutor, CancellationToken cancellationToken)
   |          at Microsoft.Azure.WebJobs.Extensions.Storage.Blobs.Listeners.ScanBlobScanLogHybridPollingStrategy.RegisterAsync(BlobServiceClient blobServiceClient, BlobContainerClient container, ITriggerExecutor`1 triggerExecutor, CancellationToken cancellationToken)
   |          at Microsoft.Azure.WebJobs.Extensions.Storage.Blobs.Listeners.BlobListenerFactory.RegisterWithSharedBlobListenerAsync(String hostId, SharedBlobListener sharedBlobListener, BlobServiceClient blobClient, BlobTriggerQueueWriter blobTriggerQueueWriter, CancellationToken cancellationToken)
   |          at Microsoft.Azure.WebJobs.Extensions.Storage.Blobs.Listeners.BlobListenerFactory.CreateAsync(CancellationToken cancellationToken)
   |          at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer.ListenerFactory.CreateAsync(CancellationToken cancellationToken) in D:\a\_work\1\s\src\Microsoft.Azure.WebJobs.Host\Indexers\FunctionIndexer.cs:line 485
   |          at Microsoft.Azure.WebJobs.Host.Listeners.HostListenerFactory.CreateAsync(CancellationToken cancellationToken) in D:\a\_work\1\s\src\Microsoft.Azure.WebJobs.Host\Listeners\HostListenerFactory.cs:line 64
   |          at Microsoft.Azure.WebJobs.Host.Listeners.ListenerFactoryListener.StartAsyncCore(CancellationToken cancellationToken) in D:\a\_work\1\s\src\Microsoft.Azure.WebJobs.Host\Listeners\ListenerFactoryListener.cs:line 45
   |          at Microsoft.Azure.WebJobs.Host.Listeners.ShutdownListener.StartAsync(CancellationToken cancellationToken) in D:\a\_work\1\s\src\Microsoft.Azure.WebJobs.Host\Listeners\ShutdownListener.cs:line 29
   |          at Microsoft.Azure.WebJobs.JobHost.StartAsyncCore(CancellationToken cancellationToken) in D:\a\_work\1\s\src\Microsoft.Azure.WebJobs.Host\JobHost.cs:line 99
   |          at Microsoft.Azure.WebJobs.Script.ScriptHost.StartAsyncCore(CancellationToken cancellationToken) in /src/azure-functions-host/src/WebJobs.Script/Host/ScriptHost.cs:line 264
   |          at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
   |          at Microsoft.Azure.WebJobs.Script.WebHost.WebJobsScriptHostService.UnsynchronizedStartHostAsync(ScriptHostStartupOperation activeOperation, Int32 attemptCount, JobHostStartupMode startupMode) in /src/azure-functions-host/src/WebJobs.Script.WebHost/WebJobsScriptHostService.cs:line 376
   | info: Microsoft.Azure.WebJobs.Hosting.JobHostService[0]
   |       Stopping JobHost
   | info: Host.Startup[314]
   |       Loading functions metadata
   | Hosting environment: Production
   | Content root path: /azure-functions-host
   | Now listening on: http://[::]:80
   | Application started. Press Ctrl+C to shut down.
   

@wayne-w-cloud
Copy link
Author

Additional info.Azurite is running on expected port

azurite  | Azurite Blob service is starting at http://0.0.0.0:9310
azurite  | Azurite Blob service is successfully listening at http://0.0.0.0:9310
azurite  | Azurite Queue service is starting at http://0.0.0.0:9311
azurite  | Azurite Queue service is successfully listening at http://0.0.0.0:9311
azurite  | Azurite Table service is starting at http://0.0.0.0:9312
azurite  | Azurite Table service is successfully listening at http://0.0.0.0:9312

When I connect it using Azure storage Explore. It is default to
Screenshot 2024-04-03 at 11 20 33 AM

Could this be an issue?

@EmmaZhu
Copy link
Collaborator

EmmaZhu commented Apr 9, 2024

Hi @wayne-w-cloud

Can you enable debug log in Azurite? Following is a sample to let Azurite in docker output debug log to folder c:/azurite:/workspace:

docker run -p 7777:7777 -p 8888:8888 -p 9999:9999 -v c:/azurite:/workspace mcr.microsoft.com/azure-storage/azurite azurite -l /workspace -d /workspace/debug.log --blobPort 7777 --blobHost 0.0.0.0 --queuePort 8888 --queueHost 0.0.0.0 --tablePort 9999 --tableHost 0.0.0.0

You can see it map docker container's workspace to c:/azurite:/workspace, and output debug log to workspace folder.

@blueww blueww added question Further information is requested blob-storage labels May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blob-storage question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants