@slack/bolt version
4.7.2
Your App and Receiver Configuration
const awsLambdaReceiver = new AwsLambdaReceiver({
signingSecret: SLACK_SIGNING_SECRET,
})
const app = new App({
token: process.env.SLACK_BOT_TOKEN,
receiver: awsLambdaReceiver,
})
Node.js runtime version
v22.22.2
Steps to reproduce:
- Create a Lambda proxy integration in AWS API Gateway with the payload version
v1 (e.g., with the CDK construct LambdaRestApi).
- Create a handler in TypeScript with
import type { APIGatewayProxyEvent, APIGatewayProxyResult, Callback, Context } from "aws-lambda"
export const handler = async (
event: APIGatewayProxyEvent,
context: Context,
callback: Callback,
): Promise<APIGatewayProxyResult> => {
console.log(event)
const boltHandler = await awsLambdaReceiver.start()
return await boltHandler(event, context, callback)
}
- Confirm that the
console.log returns an event with multiValueQueryStringParameters: null.
Expected result:
No type errors.
Actual result:
There is a type mismatch when calling boltHandler. It expects as first argument AwsEvent = AwsEventV1 | AwsEventV2 (in our case, only AwsEventV1 is relevant). But the handler actually receives APIGatewayProxyEvent.
APIGatewayProxyEvent is the correct type to use since it allows null for multiValueQueryStringParameters, which is what the handler is called with (confirmed via the console.log above).
The only difference between AwsEventV1 and APIGatewayProxyEvent (defined here) is that AwsEventV1 does not allow multiValueQueryStringParameters to be null while APIGatewayProxyEvent does.
See also #2277, where the type mismatch was probably introduced.
Workaround
Cast to AwsEventV1:
return await boltHandler(event as AwsEventV1, context, callback)
@slack/boltversion4.7.2Your
Appand Receiver ConfigurationNode.js runtime version
v22.22.2Steps to reproduce:
v1(e.g., with the CDK constructLambdaRestApi).console.logreturns an event withmultiValueQueryStringParameters: null.Expected result:
No type errors.
Actual result:
There is a type mismatch when calling
boltHandler. It expects as first argumentAwsEvent = AwsEventV1 | AwsEventV2(in our case, onlyAwsEventV1is relevant). But the handler actually receivesAPIGatewayProxyEvent.APIGatewayProxyEventis the correct type to use since it allowsnullformultiValueQueryStringParameters, which is what the handler is called with (confirmed via theconsole.logabove).The only difference between
AwsEventV1andAPIGatewayProxyEvent(defined here) is thatAwsEventV1does not allowmultiValueQueryStringParametersto benullwhileAPIGatewayProxyEventdoes.See also #2277, where the type mismatch was probably introduced.
Workaround
Cast to
AwsEventV1: