Giter Site home page Giter Site logo

eschultink / s3-for-google-apps-script Goto Github PK

View Code? Open in Web Editor NEW
89.0 89.0 37.0 56 KB

a binding for using AWS Simple Storage Service (S3) from Google Apps Script

Home Page: http://engetc.com/projects/amazon-s3-api-binding-for-google-apps-script/

License: BSD 3-Clause "New" or "Revised" License

JavaScript 100.00%

s3-for-google-apps-script's People

Contributors

eschultink avatar sakazuki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

s3-for-google-apps-script's Issues

List of files

Awesome script man!
Can you add a way to get a list of files inside a bucket?
Or can you point me in the right direction to it?

Thanks in advance. Best!

Region is hardcoded

return "http://" + this.bucket.toLowerCase() + **".s3.amazonaws.com/"** + this.objectName;
Need a setter method to configure region. Will send a pull request if I get time.

AWS Error when uploading - auth mechanism

Thanks a lot for your time and effort!

Code:
const s3 = S3.getInstance('**', '*****');

Error:
AWS Error - InvalidRequest: The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256. (line 184, file "S3Request")

Log:

[20-12-09 09:55:14:477 CET] 
-- REQUEST --
	validateHttpsCertificates: true
	useIntranet: false
	url: http://somebucket.s3.amazonaws.com/sometxt.txt
	payload: {somepayload}
	followRedirects: true
	contentType: text/plain
	method: put
	headers: [object Object]
-- RESPONSE --
HTTP Status Code: 400
Headers:
	x-amz-region: eu-central-1
	Date: Wed, 09 Dec 2020 08:55:13 GMT
	Transfer-Encoding: chunked
	Connection: close
	Content-Type: application/xml
	x-amz-request-id: 8E57614D544167FE
	x-amz-id-2: 9wB443lVIGEzVKjtT4UaUPRj1jG6XNUGSF64tVQGRmF0zq/5OyNSoMb5g5cp8Q58rw0OnT5piZo=
	Server: AmazonS3
Body:
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>InvalidRequest</Code><Message>The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256.</Message><RequestId>8E57614D544167FE</RequestId><HostId>9wB443lVIGEzVKjtT4UaUPRj1jG6XNUGSF64tVQGRmF0zq/5OyNSoMb5g5cp8Q58rw0OnT5piZo=</HostId></Error>
[20-12-09 09:55:14:492 CET] AWS Error - InvalidRequest: The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256.
    at S3Request.execute(S3Request:184:5)
    at S3.putObject(S3:146:11)

Upload Image (PNG file) from Google App Script to S3 Bucket

Trying to upload a png file:

// get the image blob
const imgBlob = UrlFetchApp.fetch('imageUrl').getBlob();
  
// init S3 instance
const s3 = S3.getInstance(awsAccessKeyId, awsSecretKey);

// upload the image to S3 bucket
s3.putObject(bucketName, 'test.png', imgBlob, { logRequests:true });

File is uploading in S3 but not in perfect way! It's look like:

Screenshot 2020-04-29 at 5 18 18 AM

If I download the image and open getting the error:

It may be damaged or use a file format that Preview doesn’t recognize.

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.