aws-lambda

API Gateway returning 403 - Forbidden

别说谁变了你拦得住时间么 提交于 2020-01-04 04:36:20
问题 I have an API Gateway with an endpoint that is fulfilled by AWS Lambda proxy integration. I have also configured a custom authorizer for this endpoint. I am seeing an issue where the first request that I make to this endpoint is successful, but additional calls will fail; I get a 403 - Forbidden error. If I wait a while, I can make another request that succeeds but then I start seeing the same problem. Here's my code for the authorizer: const jwt = require('jsonwebtoken'); exports.authorizer

Permission denied after uploading AWS Lambda python zip from S3

馋奶兔 提交于 2020-01-04 03:15:12
问题 When uploading a python zip package to AWS Lambda from S3 I get the following cryptic error: module initialization error: [Errno 13] Permission denied: '/var/task/lambda_function.py' The error seems to be that if you create a zip package with restrictive permissions, then AWS gets confused. Essentially, AWS unzips your package with the permissions you gave it and tries to use it. What can make this especially confusing is that you may be able to see part of the zip files from the AWS Lambda

Permission denied after uploading AWS Lambda python zip from S3

我的梦境 提交于 2020-01-04 03:15:09
问题 When uploading a python zip package to AWS Lambda from S3 I get the following cryptic error: module initialization error: [Errno 13] Permission denied: '/var/task/lambda_function.py' The error seems to be that if you create a zip package with restrictive permissions, then AWS gets confused. Essentially, AWS unzips your package with the permissions you gave it and tries to use it. What can make this especially confusing is that you may be able to see part of the zip files from the AWS Lambda

AWS Lambda: Ruby function failing to load gem

扶醉桌前 提交于 2020-01-03 19:04:16
问题 I have a Ruby Lambda function which depends on an external (ie non-AWS) RubyGem. I have a Gemfile , a Gemfile.lock and a vendor/bundle directory. Everything looks fine from a local perspective. I've tried using bundle install --path vendor/bundle and bundle install --deployment to install the gems, and am specifically including the vendor directory when zipping up the files: zip -r function.zip myfunction.rb vendor Despite this, when I test the function in the Lambda console, it's failing

AWS Lambda Console - Upgrade boto3 version

南笙酒味 提交于 2020-01-03 17:49:31
问题 I am creating a DeepLens project to recognise people, when one of select group of people are scanned by the camera. The project uses a lambda, which processes the images and triggers the ' rekognition ' aws api. When I trigger the API from my local machine - I get a good response When I trigger the API from AWS console - I get failed response Problem After much digging, I found that the 'boto3' (AWS python library) is of version: 1.9.62 - on my local machine 1.8.9 - on AWS console Question

Stop a Lambda function in Python

我的梦境 提交于 2020-01-03 10:46:26
问题 Inside a certain function I want to stop the whole Lambda process but not trigger an error. I've tried looking at the context variable to stop it or just calling exit() but each time it's treated as an error which I don't want to track. How can I end successfully a Lambda process in Python? 回答1: In AWS Lambda you define a handler function and in Python a function just needs to return in order to complete successfully, where return implies return None . What you've done is correct, just have

Convert wav to mp3 in node js

安稳与你 提交于 2020-01-03 06:40:18
问题 Is there any npn packages to convert a wav file to mp3 file in node js? I want to run this script in aws lambda function. I tried sox and sox-audio packages, but it is not supported in lambda. I googled ffmpeg, didn't find any convertion between wav to mp3. Does any one give a good convertion package in node js? console.log('New Lambda Call'); var async = require('async'); var aws = require('aws-sdk'); var fs = require('fs'); var uuid = require('node-uuid'); var SoxCommand = require('sox

Remove nested attributes from dynamoDB Items - nodejs

点点圈 提交于 2020-01-03 05:54:35
问题 I have a single item in dynamodb { "id": "123", "201907240815": { "userid1": { "name": "Hello", "email": "test@example.com" }, "userid2": { "name": "World", "email": "world@example.com" } } } I need to remove the nested attribute. ex: 201907240815.userid1 . I had to try below code but it not worked const param = { TableName:'userinfo', Key:{id:'123'}, UpdateExpression:'remove 201907240815.userid1', ReturnValues: 'UPDATED_NEW' } try{ const response = await dynamoDB.update(param).promise();

Why do I get 403 forbidden error while posting a json to elasticsearch endpoint on AWS?

北战南征 提交于 2020-01-03 05:45:09
问题 I am posting a json to AWS elasticsearch,using a java lambda function. public Object handleRequest(DynamodbEvent dynamodbEvent, Context context) { //code to general the json document AmazonDynamoDBClient amazonDynamoDBClient = new AmazonDynamoDBClient(); List<DynamodbEvent.DynamodbStreamRecord> dynamodbStreamRecordlist = dynamodbEvent.getRecords(); if (!dynamodbStreamRecordlist.isEmpty()) { DynamodbEvent.DynamodbStreamRecord record = dynamodbStreamRecordlist.get(0); if(record.getEventSource()

AWS Lambda To Atlas

▼魔方 西西 提交于 2020-01-03 05:43:07
问题 I want to connect my Lambda function to Mongo Atlas. It was all working fine but I needed to move my function inside a VPC so I could use redis. Now I cannot connect to my database. I looked at the security group on the VPC and added the mongo db port but with no joy Also - the mongo IP Whitelist is as follows for now 0.0.0.0/0 (includes your current IP address) Is there anything else I should try? Thank you 回答1: I needed to move my function inside a VPC so I could use redis. If you are: