GithubHelp home page GithubHelp logo

Comments (9)

TranBaVinhSon avatar TranBaVinhSon commented on May 20, 2024 1

@Tetsunori-Mitarai I tried both your lib and patch-1 but still got same error:

AWS Error - InvalidRequest: The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256.

from google-sheet-s3.

gloomylumi avatar gloomylumi commented on May 20, 2024 1

I ended up having to scrap the S3 binding originally used with this add-on. I was adapting the add-on for use Google Forms, rather than Sheets anyway. I used this repo instead and replaced the code under the 'upload to s3' comment on line 63 with a call to wrapper function that looked like this:

function s3PutObject(objectName, object) {
  const props = PropertiesService.getDocumentProperties().getProperties()

  const contentBlob = Utilities.newBlob(JSON.stringify(object), "application/json")
  contentBlob.setName(objectName)
  
  const service = 's3'
  const region = 'us-east-2'
  const action = 'PutObject'
  const params = {}
  const method = 'PUT'
  const payload = contentBlob.getDataAsString()
  const headers = {}
  const uri = '/' + objectName
  const options = {
    Bucket: props.bucketName
  }

  AWS.init(props.awsAccessKeyId, props.awsSecretKey)
  const response = AWS.request(service, region, action, params, method, payload, headers, uri, options)
  return response
}

In the context of this repo, the function call would look like:

s3PutObject([props.path, sheet.getId()].join('/'), cells)

Hope this helps someone else!

from google-sheet-s3.

socialwithin-eng avatar socialwithin-eng commented on May 20, 2024

Hey @jpiccirillo, I am running into the same issue. Did you ever end up figuring out what was the problem?

from google-sheet-s3.

liddiard avatar liddiard commented on May 20, 2024

Sorry for the late reply on this! It looks like the authorization mechanism used by the S3 Google Apps Script that my script is using is no longer supported.

The author of the S3 upload script says someone tried to fix it with this PR, though one of the commenters on that PR said it's still not working, so it's unclear if the fix works 😕

I'm no longer actively developing/using this project, but if someone wants to test if that fork works, I'm happy to update the installation instructions to use it instead.

from google-sheet-s3.

Tetsunori-Mitarai avatar Tetsunori-Mitarai commented on May 20, 2024

hi, @jpiccirillo @liddiard @socialwithin-eng :)

I'm using same script and, tried fixing and testing issues in my repository.
(at least, made working. but still under testing.)
https://github.com/Tetsunori-Mitarai/S3-for-Google-Apps-Script/tree/fixAuthV4

if you using patch-1
then, you can use same instructions.

and, some S3Test.gs legacy codes have problems, yet.
ex: when delete no exists bucket, gonna get auth failed.(not get delete fail)

from google-sheet-s3.

liddiard avatar liddiard commented on May 20, 2024

What AWS regions are you all using? I haven't had a chance to test @Tetsunori-Mitarai 's changes myself (thanks for the work btw!), but I did some brief googling and found this issue which led me to this page of the AWS docs. The docs say that specific regions only support the newer v4 auth mechanism, while other regions still support v2.

I just tried the existing script again on a bucket I have in the US West (Oregon) region and it's still working fine. I realize this might not be a long-term solution if AWS is planning on migrating all regions to the newer signing process, but for now it's still working for me in a region that's not in that list.

from google-sheet-s3.

liddiard avatar liddiard commented on May 20, 2024

If anyone's willing to develop it, and alternate solution might be to use Google Cloud Storage (Google's equivalent to S3) to host the JSON files instead of AWS. I found a blog with a sample script and a sample application to do that.

from google-sheet-s3.

liddiard avatar liddiard commented on May 20, 2024

Actually after looking at the AWS docs linked above again, I see S3 isn't in the list of "AWS services that support Signature Version 2", so changing regions might not fix it after all.. Definitely seems like upgrading to signature version 4 would be best 😕

from google-sheet-s3.

dariusbhx avatar dariusbhx commented on May 20, 2024

I just ran into this issue when using django i found this thread on stack-overflow:
https://stackoverflow.com/questions/26533245/the-authorization-mechanism-you-have-provided-is-not-supported-please-use-aws4

In my case I was using django and added the following line in settings.py file and the error was solved:
AWS_S3_REGION_NAME = "eu-west-2"
Just replace eu-west-2 with your region.
Hope this helps!

from google-sheet-s3.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.