Skip to content

Commit

Permalink
fix(lambda): invoke lambda with actual AWS SDK version
Browse files Browse the repository at this point in the history
  • Loading branch information
jagregory committed Apr 13, 2020
1 parent 5f76d86 commit bed1b7c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/services/lambda.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import { CognitoUserPoolEvent } from "aws-lambda";
import * as AWS from "aws-sdk";
import { InvocationResponse } from "aws-sdk/clients/lambda";
import * as fs from "fs";
import { UnexpectedLambdaExceptionError } from "../errors";

const awsSdkPackageJson = fs.readFileSync(
require.resolve("aws-sdk/package.json"),
"utf-8"
);
const awsSdkVersion = JSON.parse(awsSdkPackageJson).version;

interface UserMigrationEvent {
userPoolId: string;
clientId: string;
Expand Down Expand Up @@ -61,7 +68,7 @@ export const createLambda: CreateLambda = (config, lambdaClient) => ({
version: 0, // TODO: how do we know what this is?
userName: event.username,
callerContext: {
awsSdkVersion: "2.656.0", // TODO: this isn't correct
awsSdkVersion,
clientId: event.clientId,
},
region: "local", // TODO: pull from above,
Expand Down

0 comments on commit bed1b7c

Please sign in to comment.