Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
blademainer opened this issue May 5, 2022 · 0 comments · Fixed by #1762

Comments

@blademainer
Copy link
Contributor

blademainer commented May 5, 2022

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
      } 
blademainer added a commit to blademainer/codimd that referenced this issue May 6, 2022
blademainer added a commit to blademainer/codimd that referenced this issue May 6, 2022
blademainer added a commit to blademainer/codimd that referenced this issue May 6, 2022
blademainer added a commit to blademainer/codimd that referenced this issue May 6, 2022
edgarogh pushed a commit to WartaPoirier-corp/codimd that referenced this issue Jun 7, 2022
jackycute added a commit that referenced this issue Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant