Closed piotrekwitkowski closed 2 years ago
The type of the response returned by the Authenticator doesn't match the CloudFrontRequestHandler response type from the aws-lambda package
Authenticator
CloudFrontRequestHandler
The types match
PR will be provided
What happened:
The type of the response returned by the
Authenticator
doesn't match theCloudFrontRequestHandler
response type from the aws-lambda packageWhat did you expect to have happen:
The types match
How to reproduce this (as precisely and succinctly as possible):
This should work
```ts import { SSMClient, GetParameterCommand } from "@aws-sdk/client-ssm"; import { CloudFrontRequestHandler } from "aws-lambda"; import { Authenticator } from "cognito-at-edge"; const ssm = new SSMClient({ region: process.env.CONFIG_PARAMETER_REGION }); const authenticatorPromise = ssm .send(new GetParameterCommand({ Name: process.env.CONFIG_PARAMETER_NAME })) .then(config => new Authenticator({ ...JSON.parse(config.Parameter!.Value!), logLevel: 'info' })); export const handler: CloudFrontRequestHandler = async event => { try { const authenticator = await authenticatorPromise; return await authenticator.handle(event); } catch (error) { console.error(error); return { body: '401 Unauthorized', status: '401' }; } }; ```Anything else you think we should know?
PR will be provided
Environment: