Parsing {errorMessage = "Error in $.queryStringParameters: parsing [] failed, expected Array, but encountered Object", actualValue = "{\"resource\":\"/{proxy+}\",\"path\":\"/test\",\"httpMethod\":\"POST\",\"headers\":{\"Accept\":\"*/*\",\"CloudFront-Forwarded-Proto\":\"https\",\"CloudFront-Is-Desktop-Viewer\":\"true\",\"CloudFront-Is-Mobile-Viewer\":\"false\",\"CloudFront-Is-SmartTV-Viewer\":\"false\",\"CloudFront-Is-Tablet-Viewer\":\"false\",\"CloudFront-Viewer-Country\":\"DE\",\"Host\":\"censored.execute-api.eu-central-1.amazonaws.com\",\"User-Agent\":\"curl/7.70.0\",\"Via\":\"2.0 2d469870f5a756385a1eb37325629a1f.cloudfront.net (CloudFront)\",\"X-Amz-Cf-Id\":\"M0uUf8tz1ay0UaVK2Evxy2-XKPR3FHLCAmQiKMPComtwpHdB6Fq48A==\",\"X-Amzn-Trace-Id\":\"Root=1-5f1611af-24cc28a6b79825eec469b128\",\"X-Forwarded-For\":\"188.193.101.224, 54.239.135.134\",\"X-Forwarded-Port\":\"443\",\"X-Forwarded-Proto\":\"https\"},\"multiValueHeaders\":{\"Accept\":[\"*/*\"],\"CloudFront-Forwarded-Proto\":[\"https\"],\"CloudFront-Is-Desktop-Viewer\":[\"true\"],\"CloudFront-Is-Mobile-Viewer\":[\"false\"],\"CloudFront-Is-SmartTV-Viewer\":[\"false\"],\"CloudFront-Is-Tablet-Viewer\":[\"false\"],\"CloudFront-Viewer-Country\":[\"DE\"],\"Host\":[\"censored.execute-api.eu-central-1.amazonaws.com\"],\"User-Agent\":[\"curl/7.70.0\"],\"Via\":[\"2.0 2d469870f5a756385a1eb37325629a1f.cloudfront.net (CloudFront)\"],\"X-Amz-Cf-Id\":[\"M0uUf8tz1ay0UaVK2Evxy2-XKPR3FHLCAmQiKMPComtwpHdB6Fq48A==\"],\"X-Amzn-Trace-Id\":[\"Root=1-5f1611af-24cc28a6b79825eec469b128\"],\"X-Forwarded-For\":[\"188.193.101.224, 54.239.135.134\"],\"X-Forwarded-Port\":[\"443\"],\"X-Forwarded-Proto\":[\"https\"]},\"queryStringParameters\":{\"p1\":\"a\",\"p2\":\"b\"},\"multiValueQueryStringParameters\":{\"p1\":[\"a\"],\"p2\":[\"b\"]},\"pathParameters\":{\"proxy\":\"test\"},\"stageVariables\":{\"stage\":\"development\"},\"requestContext\":{\"resourceId\":\"r236sb\",\"resourcePath\":\"/{proxy+}\",\"httpMethod\":\"POST\",\"extendedRequestId\":\"P_ezeFsqFiAFpdA=\"* Connection #0 to host censored.execute-api.eu-central-1.amazonaws.com left intact
,\"requestTime\":\"20/Jul/2020:21:50:39 +0000\",\"path\":\"/cestStage108C25QZEY860/test\",\"accountId\":\"censored\",\"protocol\":\"HTTP/1.1\",\"stage\":\"cestStage108C25QZEY860\",\"domainPrefix\":\"censored\",\"requestTimeEpoch\":1595281839755,\"requestId\":\"92709229-beca-480e-986f-22158bcb3ff1\",\"identity\":{\"cognitoIdentityPoolId\":null,\"accountId\":null,\"cognitoIdentityId\":null,\"caller\":null,\"sourceIp\":\"188.193.101.224\",\"principalOrgId\":null,\"accessKey\":null,\"cognitoAuthenticationType\":null,\"cognitoAuthenticationProvider\":null,\"userArn\":null,\"userAgent\":\"curl/7.70.0\",\"user\":null},\"domainName\":\"censored.execute-api.eu-central-1.amazonaws.com\",\"apiId\":\"censored\"},\"body\":null,\"isBase64Encoded\":false}", valueName = "ApiGatewayRequest Text"}
The amazon docs example list them as objects, too.
So could the type definition Maybe [(Text, Maybe Text)] be wrong and the cause for this failure? If this can be reproduced on your side (because I'm not 100% sure), then a change to HashMap would be an awesome fix :)
apiGatewayRequestQueryStringParameters
is defined asMaybe [(Text, Maybe Text)]
. Other params are defined asMaybe (HashMap Text Text)
.https://github.com/theam/aws-lambda-haskell-runtime/blob/1eda275e2c4c0f600bcfbae6f1b0979926d630dc/src/Aws/Lambda/Runtime/ApiGatewayInfo.hs#L34-L36
I'm currently seeing an error with an api gateway request trying to use query parameters:
Query Params and e.g. path params seem to be encoded the same way as JSON objects. This is taken from the failure:
Query params
Path params
Complete failure
The amazon docs example list them as objects, too.
So could the type definition
Maybe [(Text, Maybe Text)]
be wrong and the cause for this failure? If this can be reproduced on your side (because I'm not 100% sure), then a change toHashMap
would be an awesome fix :)