I’m using a simple api call that needs Digest Auth: const { default: AxiosDigestAuth } = require(‘@mhoc/axios-digest-auth’); exports.handler = async () => { const digestAuth = new AxiosDigestAuth({ username: user, password: pass, }); await digestAuth.request({ headers: { ‘Content-Type’: ‘application/json’, Connection: ‘keep-alive’, Accept: ‘application/json’, }, method: ‘POST’, url: ‘https://sms.voxbone.com:4443/sms/v1/’, data, }); }; I thought the issue ..
Category : aws-lambda
I have a repository with several npm packages in it. Each package is a lambda function, and moving to a single package would bloat and complicate the project. Each is currently responsible for its own unit testing. All are uniformly using jest, with the axios-mock-adapter and the aws-service-mock libraries. I’d like to move the unit ..
After declaring two variables param01 and param02 I go ahead and check if the incoming event.pathParameters is not undefined: let param01, param02; if (event.pathParameters!=undefined) { if (event.pathParameters.param01!=undefined) { param01 = event.pathParameters.param01; } if (event.pathParameters.param02!=undefined) { param02 = event.pathParameters.param02; } } While it works fine, it takes 10 lines of code. I wonder if there is ..
I’m looking for a solution whereby I can safely (and nearly reliably) emit CW metrics (putMetricData) within synchronous code. My use case is as follows: // Lambda Main Handler export const handler = async () => { await step1Aync(); step2Sync(); step3Sync(); return {}; } async function step1Aync() { await doSomething(); await doSomething(); // could await ..
My goal is to build a node with express app which receives a json, converts to HTML and finally to a PDF. The app must be deployed on AWS Lambda which has 250 MB maximum deployment package size (unzipped). I have the json to HTML sorted; however the HTML to PDF conversion remains a challenge. ..
I’m reading a zip file from an S3 Bucket and unzipping that file to write to a tmp directory in a lambda function using Nodejs. I’m using JSZip to unzip the file and get each file, but when I try to do zip.file(name).async(‘blob’) my lambda function doesn’t read the line of code at all. Here ..
I have a pretty straight forward post request using axios. I have played around with JSON.stringfy, adjusted my try/catch statement, and played around with various headers. No luck. After doing some reading I think it has to do with the fact that I am not (req, res) anywhere. Thus, the lamda function returns undefined but ..
I’m very new to javascript in general and I’m doing a school project that builds a simple lambda function to save some data to DynamoDB from an HTTP request. First, I had this version: exports.handler = async (event) => { var params = { TableName: ‘graph’, ReturnConsumedCapacity: "TOTAL", Item: null }; for (let input of ..
I’m working on a lambda function in AWS that is supposed to get information from a DynamoDB and then make a post request if a flag is active. My first and successful attempt to implement this used callbacks only: handler = function (event,context) { documentClient.get(tableParameters, function(err, data) { if (err) { console.log(err); context.fail(err); } else ..
I am using the ask-sdk-core of the Alexa skill kit. I have the following LaunchRequestHandler and AudioIntentHandler. I face the issue that when I trigger the skill by just saying: "Alexa, speak to skillName" or "Alexa, start skillName" that somehow the request is sending AudioIntent and not LaunchRequest to the lambda function, thus, the audio ..
Recent Comments