When a client certificate is used to call a lambda HTTP handler, the clientCert property of the event is undefined when the code runs on serverless-offline but the clientCert is defined when running on AWS.
handler: async (event: APIGatewayProxyEvent, _context: Context, _callback: any) => {
logger.info({ event }, 'Event received');
// certificate info is a distinguished name in clientCert
// v1 is .identity.clientCert but v2 is .authentication.clientCert
if (!event.requestContext.identity?.clientCert)
throw new Error('A client certificate is required on this endpoint');
}
}
Bug Report
Current Behavior
When a client certificate is used to call a lambda HTTP handler, the clientCert property of the event is undefined when the code runs on serverless-offline but the clientCert is defined when running on AWS.
Sample Code
Client code:
Server code:
file: serverless.js
Expected behavior/code
The error "'A client certificate is required on this endpoint" is not thrown.
Environment
serverless-offline
version: 12.0.4node.js
version: 18.0.0OS
: macOS 13.5.1Additional context/Screenshots
Log output of
event
object from the code example above: