aws-beam / aws-codegen

Code generator for AWS clients in Erlang and Elixir.
Other
53 stars 49 forks source link

Avoid bucket in both Path and Host as this causes NoSuchKey errors #86

Closed onno-vos-dev closed 2 years ago

onno-vos-dev commented 2 years ago

Considering we use virtual-host style of Host headers since https://github.com/aws-beam/aws-codegen/pull/84 we should not have the host as part of the Path as well. The intention of https://github.com/aws-beam/aws-codegen/pull/84 was to actually strip it but it failed to do so for Paths that did not contain anything but the bucket (such as aws_s3:list_objects/5).

The result is that prior to this change, the Path coming back from aws_s3:build_url/4 would be: <<"https://s3.eu-west-1.amazonaws.com:443/kfile.nonprod.eu1.kred.klarna.net">> whereas the intention of the author (me :smile: ) was to result in a path such as <<"https://s3.eu-west-1.amazonaws.com:443/">> since the bucket is already baked into the Host.

This fixes a critical bug which causes ListObjects to essentially not work at all and always returns NoSuchKey errors.

onno-vos-dev commented 2 years ago

This seems to at least break with Adobe/s3mock which is one of the mocks that we're using. Apparently it doesn't support path style properly so things get wonky... I'm trying to figure out how to do this cleanly.