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

HTTP Error 400. The request verb is invalid #5450

Closed
3 tasks done
davidmarekmsft opened this issue Mar 14, 2024 · 3 comments · Fixed by #5472 or #5473
Closed
3 tasks done

HTTP Error 400. The request verb is invalid #5450

davidmarekmsft opened this issue Mar 14, 2024 · 3 comments · Fixed by #5472 or #5473
Assignees
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team Storage Storage Service (Queues, Blobs, Files)

Comments

@davidmarekmsft
Copy link

davidmarekmsft commented Mar 14, 2024

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
@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files) labels Mar 14, 2024
Copy link

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @EmmaZhu @Jinming-Hu @vinjiang.

@RickWinter RickWinter added bug This issue requires a change to an existing behavior in the product in order to be resolved. and removed question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Mar 14, 2024
@Jinming-Hu
Copy link
Member

Jinming-Hu commented Mar 21, 2024

I think this is a bug of storage service. It seems to me the server side still expects request body when the status code is 4xx, while it shouldn't because there's Expect: 100-continue in request header.

I tried to add

this->UploadBody(context);

after Line 488

Log::Write(Logger::Level::Verbose, LogMsgPrefix + "Server rejected the upload request");

then the 2nd request succeeded.

@Jinming-Hu
Copy link
Member

This is a regression caused by #5308

@Jinming-Hu Jinming-Hu assigned RickWinter and unassigned Jinming-Hu Mar 25, 2024
@RickWinter RickWinter removed needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team Service Attention Workflow: This issue is responsible by Azure service team. labels Mar 26, 2024
@RickWinter RickWinter removed their assignment Mar 26, 2024
@github-actions github-actions bot added the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Mar 26, 2024
@RickWinter RickWinter assigned LarryOsterman and unassigned antkmsft Mar 26, 2024
azure-sdk added a commit to azure-sdk/vcpkg that referenced this issue Apr 9, 2024
## 1.11.3 (2024-04-09)

### Bugs Fixed

- [[microsoft#5450]](Azure/azure-sdk-for-cpp#5450) Reverted libcurl connection pool to use more conservative caching strategy.
- [[microsoft#4352]](Azure/azure-sdk-for-cpp#5371) Fixed compilation error on Visual Studio 2017. (A community contribution, courtesy of _[morten-ofstad](https://github.com/morten-ofstad)_)

### Acknowledgments

Thank you to our developer community members who helped to make Azure Core better with their contributions to this release:

- Morten Ofstad _([GitHub](https://github.com/morten-ofstad))_
azure-sdk added a commit to azure-sdk/vcpkg that referenced this issue May 9, 2024
## 1.12.0 (2024-05-09)

### Bugs Fixed

- [[microsoft#5450]](Azure/azure-sdk-for-cpp#5450) Fixed libcurl connection pool to use `Connection` response header values.
@github-actions github-actions bot locked and limited conversation to collaborators Jul 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
5 participants