I have already successfully set up a local, AWS Swift Lambda testing environment. I can invoke the lambda by sending a POST request to http://localhost:7000/invoke
with a body formatted as a APIGateway.V2.Request
object. That works properly.
Here is the payload that works properly:
{
"routeKey":"",
"version":"",
"rawPath":"",
"body": "{\"email\": \"test@gmail.com\", \"password\": \"password\",\"device_token\": \"a device token\" }",
"requestContext":{
"accountId":"",
"apiId":"",
"domainName":"",
"domainPrefix":"",
"stage": "",
"requestId": "",
"http":{
"path":"/api/v1/user/login",
"method":"",
"protocol":"",
"sourceIp":"",
"userAgent":""
},
"time": "",
"timeEpoch":0
},
"isBase64Encoded":false,
"rawQueryString":"",
"headers":{}
}
The problem arises when I try to invoke the lambda at the path http://localhost:7000/invoke/api/v1/user/login
; as this is the path — aside from the base URL — that the iOS app would use to interact with the lambda in production. When I do this I get a "404 Not Found" error.
What this means is that when I test the app locally and I change the base URL from the app's domain name to http://localhost:7000/invoke/
, all of the requests will fail, as the app will apply the specific endpoint to the base URL, but the local lambda will refuse interaction with it.
How do I enable a local AWS Swift Lambda to support more than just the default /invoke
path?