aws-sam-cli icon indicating copy to clipboard operation
aws-sam-cli copied to clipboard

Unable to upload artifact using SAM CLI Version 1.109.0

Open awsmantra opened this issue 2 years ago • 16 comments

I have upgraded my local sam-cli version to 1.109.0

Now when I am trying to upload artifact, I am getting below error

Error: Unable to upload artifact HelloWorldFunction referenced by CodeUri parameter of HelloWorldFunction resource. An HTTP Client raised an unhandled exception: sequence item 0: expected str instance, bytes found

I was able to upload all my prior SAM projects before upgrading to this new version

awsmantra avatar Feb 09 '24 04:02 awsmantra

Seeing the same error message when deploying this code sample with SAM CLI 1.109.0 and 1.108.0.

It works when I downgrade to 1.106.0.

pbv0 avatar Feb 09 '24 12:02 pbv0

I completely removed sam-cli and use there installable package. How did you downgrade version ?

awsmantra avatar Feb 09 '24 15:02 awsmantra

You can download old versions for your OS here on GitHub under Releases.

e.g. here 1.106.0 https://github.com/aws/aws-sam-cli/releases/tag/v1.106.0

pbv0 avatar Feb 09 '24 15:02 pbv0

I installed aws-sam-cli using homebrew and it stop working. I completely removed package from my local and use installable pacakge.

awsmantra avatar Feb 09 '24 15:02 awsmantra

Hey @awsmantra thanks for reporting the issue and @pbv0 for providing an example to reproduce the issue. However, I tried two installation methods (using pip install in a venv and using MacOS Installer in an Intel Mac) and couldn't reproduce the issue. Could you please which OS and installation method you used?

@pbv0 In the code sample you provided, did it not work in the backend or the frontend or both?

hawflau avatar Feb 09 '24 22:02 hawflau

I am getting the same error with 1.109.0.

Here's the output of deployment with --debug on:

2024-02-12 05:41:36,703 | Unable to find Click Context for getting session_id.
2024-02-12 05:41:36,708 | Sending Telemetry: {'metrics': [{'events': {'requestId': 'c0b31d56-0433-4541-860a-0326beff394e', 'installationId': '49ea70ab-17f8-43ca-9d1f-d8e3e43ebebc', 'sessionId': 'bc4e0b0c-3b8b-450d-814c-ad225b8ed7e3', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.12.1', 
'samcliVersion': '1.109.0', 'commandName': 'sam deploy', 'metricSpecificAttributes': {'events': [{'event_name': 'SamConfigFileExtension', 'event_value': '.toml', 'thread_id': '9318a650db3645218272fb6cea48c08e', 'time_stamp': '2024-02-11 16:41:32.574', 'exception_name': None}, {'event_name': 
'SamConfigFileExtension', 'event_value': '.toml', 'thread_id': 'add60d4132f746c1a92a29a3221b511a', 'time_stamp': '2024-02-11 16:41:32.681', 'exception_name': None}]}}}]}
2024-02-12 05:41:37,323 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)
Error: An HTTP Client raised an unhandled exception: sequence item 0: expected str instance, bytes found
2024-02-12 05:41:37,330 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)

falnyr avatar Feb 11 '24 16:02 falnyr

@pbv0 In the code sample you provided, did it not work in the backend or the frontend or both?

I can reproduce with the following steps (keep the default options during sam deploy):

git clone [email protected]:aws-samples/serverless-pdf-chat.git
cd serverless-pdf-chat/backend
sam build --use-container
sam deploy --guided

pbv0 avatar Feb 12 '24 05:02 pbv0

I have the same issue as described in the original description. I am using aws-sam-cli installed via brew.

After uninstalling it with brew and then installing it through package installer it started to work again. Both versions were 1.109.0

domengabrovsek avatar Feb 12 '24 10:02 domengabrovsek

For Mac , I only see Package Installer works as mention by @domengabrovsek

awsmantra avatar Feb 12 '24 15:02 awsmantra

Got it. I'll try to reproduce the issue with SAM CLI installed through homebrew.

hawflau avatar Feb 12 '24 18:02 hawflau

Hey all,

Right now if you install AWS SAM CLI through homebrew, homebrew installs urllib3 2.2.0 (released on 2024-01-30) as a dependency. However, botocore, another SAM CLI's dependency, requires urllib3 < 2.1, as specified here. urllib3 2.2.0 might contain breaking changes that break botocore, thus resulting in the errors you all saw. Botocore still has an open issue to address it and we are blocked by that.

We recommend you to install SAM CLI through package installer. Please let us know if you have any further questions.

hawflau avatar Feb 12 '24 19:02 hawflau

created an issue in homebrew-core to follow up - https://github.com/Homebrew/homebrew-core/issues/162626

hawflau avatar Feb 14 '24 00:02 hawflau

hmo-5o1d avatar Feb 14 '24 01:02 hmo-5o1d

Hey all, closing the issue as homebrew has fixed the issue through https://github.com/Homebrew/homebrew-core/pull/162634. I tried it myself (with brew install aws-sam-cli) and confirmed that it worked.

Feel free to raise a new issue if there is still any issue/question.

hawflau avatar Feb 14 '24 18:02 hawflau

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

github-actions[bot] avatar Feb 14 '24 18:02 github-actions[bot]

I completely removed sam-cli and use there installable package. How did you downgrade version ?

this worked for me, I removed the Brew package and install the downloaded package ( ver. 1.115.0)

JaphetMataImp avatar May 02 '24 16:05 JaphetMataImp