Skip to content

Instantly share code, notes, and snippets.

@cassiozen
Created November 17, 2016 19:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save cassiozen/9e5f98812f44e0acf0b3ec011869e394 to your computer and use it in GitHub Desktop.
Save cassiozen/9e5f98812f44e0acf0b3ec011869e394 to your computer and use it in GitHub Desktop.
module.exports.requestUploadURL = (event, context, callback) => {
var s3 = new AWS.S3();
var params = JSON.parse(event.body);
var s3Params = {
Bucket: 'slsupload',
Key: params.name,
ContentType: params.type,
ACL: 'public-read',
};
var uploadURL = s3.getSignedUrl('putObject', s3Params);
callback(null, {
statusCode: 200,
headers: {
'Access-Control-Allow-Origin': 'https://www.my-site.com'
},
body: JSON.stringify({ uploadURL: uploadURL }),
})
}
@thorharaldsson
Copy link

Hey, so I followed your tutorial on Netify and i seem to be stuck somewhere. When I sls deploy, I don't get a post endpoint, what I get is:
.........
Serverless: Stack update finished...
Service Information
service: imageupload
stage: dev
region: us-east-1
stack: imageupload-dev
api keys:
None
endpoints:
None
functions:
hello: imageupload-dev-hello
layers:
None
.........

Any pointers?

@insanity54
Copy link

insanity54 commented Jul 30, 2020

Hey, so I followed your tutorial on Netify and i seem to be stuck somewhere. When I sls deploy, I don't get a post endpoint, what I get is:
.........
Serverless: Stack update finished...
Service Information
service: imageupload
stage: dev
region: us-east-1
stack: imageupload-dev
api keys:
None
endpoints:
None
functions:
hello: imageupload-dev-hello
layers:
None
.........

Any pointers?

In your CLI, run the command, serverless info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment