Skip to content
Advertisement

Tag: aws-sdk

Return URL from file uploaded to AWS S3

I have a function that makes an API request containing the URL of a new file I just uploaded to AWS S3. And I have one function that only upload the file to S3. I am having issues with returning this URL of the uploaded file. Here is my code: Here is the SDK doc with the upload example: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#upload-property

Get AWS S3 Upload URL – NodeJs AWS-SDK

I’m pretty sure I’m missing something very obvious here, but: I’m uploading a file to an s3 bucket using aws-sdk as follows: I’m able to log the upload url successfully, however the awsURL returned is an array, not the data.Location value – shouldn’t the data.Location be returned from the callback? Answer Convert s3.upload to return a promise:

How do I test if a bucket exists on AWS S3

How do I test if a bucket exists on AWS S3 using the aws-sdk? This question is for testing if an object exists within a bucket: How to determine if object exists AWS S3 Node.JS sdk This question is for Python: How can I check that a AWS S3 bucket exists? Answer You can use the following code: The important

Mock a dependency’s constructor Jest

I’m a newbie to Jest. I’ve managed to mock my own stuff, but seem to be stuck mocking a module. Specifically constructors. usage.js I’d like to do something like this in the tests. However when I come to use it in usage.js the cw is a mockConstructor not a FakeMetrics I realise that my approach might be ‘less than idiomatic’

How to use the code returned from Cognito to get AWS credentials?

Right now, I’m struggling to understand AWS Cognito so maybe someone could help me out. I set a domain to serve Cognito’s hosted UI for my User Pool like what’s described here. So when I go to https://<my-domain>.auth.us-east-1.amazoncognito.com/login?response_type=code&client_id=<MY_POOL_CLIENT_ID>&redirect_uri=https://localhost:8080 I get a login page where my users can login to my app with Google. That part is working great. I’m confused

Advertisement