cloudsmith-cli icon indicating copy to clipboard operation
cloudsmith-cli copied to clipboard

Pushing nuget package raise an error: Failed to upload file! (status: 400 - Bad Request)

Open moh-hassan opened this issue 2 years ago • 0 comments

Environment: OS: windows 11 python 3.9.6 is installed

cloudsmith --version

Versions:
CLI Package Version: 1.1.1
API Package Version: 2.0.7

I try to upload nuget package to cloudsmith with the command:

cloudsmith push nuget -k abc123  myorg/o2p mypackage.6.2.0.nupkg

but i get error

Failed to upload file! (status: 400 - Bad Request) 

although key is valid and Uploading is 100% The output is:

Checking nuget package upload parameters ... OK
Checking mypackage.6.2.0.nupkg file upload parameters ... OK
Requesting file upload for mypackage.6.2.0.nupkg ... OK
Uploading mypackage.6.2.0.nupkg:  [####################################]  100%
ERROR
Failed to upload file! (status: 400 - Bad Request)

What is wrong and how to fix the error?

Update I traced the request/response using fiddler. The requests in order are: 204->204->202->400 It seems the error 400 is from AmazonS3 due to : Unsupported Authorization Type error

The details of 400 error:

The request

POST https://cloudsmith-package-uploads-prd.s3-accelerate.amazonaws.com/ HTTP/1.1
Host: cloudsmith-package-uploads-prd.s3-accelerate.amazonaws.com
user-agent: cloudsmith-cli/odata cli:1.1.1 api:2.0.7
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
content-type: multipart/form-data; boundary=3ec17d64043349648469559a823ad667
Content-Length: 1147196
Authorization: Basic abcxyz=

.... rest file binary contents

The response

HTTP/1.1 400 Bad Request
Content-Type: application/xml
Transfer-Encoding: chunked
Connection: keep-alive
x-amz-request-id: THSXS5KPHX6JGZD0
x-amz-id-2: bbdLyfZOA/4szLDNZxNHCDVDisxUA75obiiiLrhWGzfvIw+btmBWzsu87vTvrf0eBgLWd0ClD4Q=
Date: Sat, 04 Nov 2023 18:50:26 GMT
Server: AmazonS3
X-Cache: Error from cloudfront
Via: 1.1 70c565ac15f71f0aa26aecd3763d4108.cloudfront.net (CloudFront)
X-Amz-Cf-Pop: MRS52-P1
X-Amz-Cf-Id: tWb8FYKnrSMCFPu0EXBjxnBu6ZeIzSCd_CW7VTlN7dRKcFnjR5LVOQ==

166
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>InvalidArgument</Code><Message>Unsupported Authorization Type</Message><ArgumentName>Authorization</ArgumentName><ArgumentValue>Basic ??????????=</ArgumentValue><RequestId>THSXS5KPHX6JGZD0</RequestId><HostId>bbdLyfZOA/4szLDNZxNHCDVDisxUA75obiiiLrhWGzfvIw+btmBWzsu87vTvrf0eBgLWd0ClD4Q=</HostId></Error>
0

moh-hassan avatar Nov 03 '23 18:11 moh-hassan