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

Cannot add --skipApiVersionCheck when using testcontainers #2432

Open
ShaharPrishMSFT opened this issue Jul 19, 2024 · 3 comments
Open

Cannot add --skipApiVersionCheck when using testcontainers #2432

ShaharPrishMSFT opened this issue Jul 19, 2024 · 3 comments
Assignees
Labels
docker question Further information is requested

Comments

@ShaharPrishMSFT
Copy link

ShaharPrishMSFT commented Jul 19, 2024

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

Blobs

Which version of the Azurite was used?

Latest - there's no version listed here: https://hub.docker.com/r/microsoft/azure-storage-azurite, but that's what I am using.

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

DockerHub

What's the Node.js version?

What's inside the image

What problem was encountered?

Cannot figure out how to pass in --skipApiVersionCheck

Steps to reproduce the issue?

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:

            var builder = new ContainerBuilder()
                .WithImage("mcr.microsoft.com/azure-storage/azurite")
                .WithPortBinding(10000, true)
                .WithPortBinding(10001, true)
                .WithPortBinding(10002, true)
                .WithName($"{_namePrefix}-azurite")
                .WithWaitStrategy(Wait.ForUnixContainer().UntilMessageIsLogged("Azurite Table service is successfully listening at"));

            if (_skipVersionCheck)
            {
                builder.WithCommand("--skipApiVersionCheck");
            }

            Container = builder.Build();

            await Container.StartAsync();

Getting the following error:

   Azure.RequestFailedException : The API version 2024-08-04 is not supported by Azurite. Please upgrade Azurite to latest version and retry. If you are using Azurite in Visual Studio, please check you have installed latest Visual Studio patch. Azurite command line parameter "--skipApiVersionCheck" or Visual Studio Code configuration "Skip Api Version Check" can skip this error. 
   RequestId:7146ecf5-712b-4593-b754-61959a659270
   Time:2024-07-19T08:43:03.147Z
  

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?

No - tried adding it via WithEntryPoint and that didn't work either.

@blueww blueww self-assigned this Jul 22, 2024
@blueww blueww added question Further information is requested docker labels Jul 22, 2024
@blueww
Copy link
Member

blueww commented Jul 22, 2024

@ShaharPrishMSFT
This doc has show how to start Azurite docker with "--skipApiVersionCheck"
https://hub.docker.com/r/microsoft/azure-storage-azurite#:~:text=tableHost%200.0.0.0%20%2D%2Dloose%20%2D%2D-,skipApiVersionCheck,-%2D%2DdisableProductStyleUrl

For how to input the parameter with the API you shows above, this is out of Azurite scope. You might can contact the API owner to get it.

@josebarros2025
Copy link

josebarros2025 commented Jul 22, 2024

If you are using Testcontainers you should take a look on this https://java.testcontainers.org/features/commands/

this is how you pass commands at least this is what its documented there.

This code example may help you a bit since we are using GenericContainers

public class AzuriteContainer extends GenericContainer<AzuriteContainer> {

    public Integer DEFAULT_PORT = 10000;

    AzuriteContainer(final DockerImageName dockerImageName) {
        super(dockerImageName);
    }

    public static AzuriteContainer create() {
        return new AzuriteContainer(DockerImageName.parse("mcr.microsoft.com/azure-storage/azurite:latest"));
    }

    @Override
    protected void configure() {
        addExposedPort(DEFAULT_PORT);
        waitingFor(Wait.forLogMessage(".*Azurite Blob service successfully listens on .*", 1)); //specific wait condition
        setCommand("azurite-blob --blobHost 0.0.0.0 --blobPort " + DEFAULT_PORT + " --skipApiVersionCheck"); //the docker command
    }
}

@matt-goldman
Copy link

@ShaharPrishMSFT is it possible your _skipVersionCheck is false here? This works for me:

private readonly AzuriteContainer _azuriteContainer = new AzuriteBuilder()
    .WithImage("mcr.microsoft.com/azure-storage/azurite:latest")
    .WithCommand("--skipApiVersionCheck")
    .Build();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants