Receiving TypeError("Cannot mix str and non-str arguments")

Bug #1897607 reported by Steve Fuller
26
This bug affects 5 people
Affects Status Importance Assigned to Milestone
apt-transport-s3 (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Ubuntu Release Info:
-----
Description: Ubuntu 20.04.1 LTS
Release: 20.04

Package Version
-----
Package: apt-transport-s3
Version: 2.0.0-1

Expected behavior
------
apt-get update runs successfully when using an S3 bucket as a source

Actual behavior
------
Receive a "TypeError: Cannot mix str and non-str arguments" and apt-get fails

Details
-------
- Our AWS instance is using an iam role for access to an S3 bucket.
- I've verified that I can list the bucket contents
- I've verified that I can copy the file to the instance via 'aws s3 cp'

Running "apt-get update" results in the following error

Traceback (most recent call last):
  File "/usr/lib/apt/methods/s3", line 597, in <module>
    method = S3_method(config)
  File "/usr/lib/apt/methods/s3", line 384, in __init__
    self.iam.get_credentials()
  File "/usr/lib/apt/methods/s3", line 191, in get_credentials
    data = self.__request_json(urllib.parse.urljoin(self.credentials_metadata,
  File "/usr/lib/python3.8/urllib/parse.py", line 512, in urljoin
    base, url, _coerce_result = _coerce_args(base, url)
  File "/usr/lib/python3.8/urllib/parse.py", line 121, in _coerce_args
    raise TypeError("Cannot mix str and non-str arguments")
TypeError: Cannot mix str and non-str arguments
Reading package lists... Done
E: Method s3 has died unexpectedly!
E: Sub-process s3 returned an error code (1)
E: Method /usr/lib/apt/methods/s3 did not start correctly
E: Failed to fetch s3://<bucket_name>/dists/focal/InRelease
E: Some index files failed to download. They have been ignored, or old ones used instead.

We were able to get this to work by adding the following to /usr/lib/apt/methods/s3 at line 190:

     self.iamrole = str(self.iamrole,'utf-8')

X-Working-Bug: Bug #1974150

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in apt-transport-s3 (Ubuntu):
status: New → Confirmed
Revision history for this message
Ryan Brosz (rbrosz) wrote :
Revision history for this message
Sebastian Nagel (wastl-nagel) wrote :

I can confirm that the problem is solved using the fix linked by Ryan Brosz.

However, v2.1.0 (https://github.com/MayaraCloud/apt-transport-s3/releases/tag/v2.1.0) fails with the error described and fixed in https://github.com/MayaraCloud/apt-transport-s3/pull/60

Revision history for this message
Sebastian Nagel (wastl-nagel) wrote :

I can confirm that the problem is solved using the fix linked by Ryan Brosz.

However, v2.1.0 (https://github.com/MayaraCloud/apt-transport-s3/releases/tag/v2.1.0) fails with the error described and fixed in https://github.com/MayaraCloud/apt-transport-s3/pull/60.

Bin Li (binli)
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.