Skip to content

Error happened when s3's provider is not aws "Unable to connect to instance metadata service" #1761

@blademainer

Description

@blademainer

When s3's api is not provided by AWS(say, googlecloud, azure), an error would happen. because the endpoint-url is overwrited by the region conditional judgment:

let s3Endpoint = 's3.amazonaws.com'
if (config.s3.endpoint) {
s3Endpoint = config.s3.endpoint
} else if (config.s3.region && config.s3.region !== 'us-east-1') {
s3Endpoint = `s3-${config.s3.region}.amazonaws.com`
}
callback(null, `https://${s3Endpoint}/${config.s3bucket}/${params.Key}`)

my suggest code to fix this bug:

      let s3Endpoint = 's3.amazonaws.com'
      if (config.s3.region && config.s3.region !== 'us-east-1') {
        s3Endpoint = `s3-${config.s3.region}.amazonaws.com`
      }
      if (config.s3.endpoint) {
        s3Endpoint = config.s3.endpoint
      } 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions