Skip to content

HTTP Error 400. The request verb is invalid #5450

@davidmarekmsft

Description

@davidmarekmsft

Describe the bug
After a recent vcpkg upgrade we started to see error "400 - The request verb is invalid" when doing a request to blob storage after a failed attempt to upload to a blob that doesn't exist. I was able to get to a minimum code sample that reproduces the issue. When we try to upload data to a blob that doesn't exist, we get an exception. If we catch the exception and try to do some other blob operation, for example, we want to create a container, the new operation fails with error 400 - The request verb is invalid.

Exception or Stack Trace

Exception: 404 The specified container does not exist.
The specified container does not exist.
RequestId:3bcbc36d-601e-0055-5a54-766ea1000000
Time:2024-03-14T21:16:12.6286930Z
Request ID: 3bcbc36d-601e-0055-5a54-766ea1000000
terminate called after throwing an instance of 'Azure::Storage::StorageException'
  what():  400 Bad Request
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request - Invalid Verb</h2>
<hr><p>HTTP Error 400. The request verb is invalid.</p>
</BODY></HTML>

Request ID: 
Aborted

To Reproduce
Run the provided code

Code Snippet

#include <iostream>

#include <azure/core.hpp>
#include <azure/storage/blobs.hpp>

std::string GetConnectionString() {
  return std::getenv("AZURE_STORAGE_CONNECTION_STRING");
}

int main() {
  const std::string connectionString = GetConnectionString();

  auto serviceClient =
      Azure::Storage::Blobs::BlobServiceClient::CreateFromConnectionString(
          connectionString);
  auto blobClient = serviceClient.GetBlobContainerClient("notexists")
                        .GetBlockBlobClient("test");

  std::string val = "some_content";
  try {
    blobClient.UploadFrom(reinterpret_cast<const uint8_t *>(val.data()),
                          val.size());
  } catch (const std::exception &e) {
    std::cout << "Exception: " << e.what() << std::endl;
  }

  auto serviceClient2 =
      Azure::Storage::Blobs::BlobServiceClient::CreateFromConnectionString(
          connectionString);
  serviceClient2.GetBlobContainerClient("create2").CreateIfNotExists();
}

Expected behavior
The call to create container "create2" should succeed.

Screenshots
n/a

Setup (please complete the following information):

  • OS: [e.g. iOS]: Ubuntu-22.04 in WSL
  • IDE : [e.g. IntelliJ]: VS Code
  • Version of the Library used: Should be the latest vcpkg
    • azure-identity-cpp: 1.6.0
    • azure-storage-blobs-cpp: 12.10.0

Additional context

The sample provided here fails with the latest vcpkg. In our codebase it fails with vcpkg ref "002c5b065927a6142dd7858813f25a10947094d8" from Feb 29, 2024.

I tried to debug the network calls with Fiddler and it was tricky to make it work from WSL to Windows, but I noticed that the PUT call to upload data to the blob that doesn't exist failed with 408 when proxied through Fiddler. The content-length header was set to 12, but no data were sent. I am wondering if the follow-up request could be prefixed by those 12 bytes that were not sent with the PUT request. It's just my idea, I wasn't able to inspect the failing request.

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Bug Description Added
  • Repro Steps Added
  • Setup information Added

Metadata

Metadata

Assignees

Labels

ClientThis issue points to a problem in the data-plane of the library.StorageStorage Service (Queues, Blobs, Files)bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK team

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions