This message was deleted.
# general
s
This message was deleted.
g
First off i'm using typescript but this seems generic enough to be a general issue. Things to know: Exporting the routes like this:
Copy code
import * as awsx from "@pulumi/awsx";


export async function pingHandler(
    event: awsx.apigateway.Request): Promise<awsx.apigateway.Response> {
    return {
        statusCode: 200,
        body: "Hello, API Gateway!",
    };
}
Currently i'm only exporting this route, but i was exporting two of them. And my index.js is here
Copy code
import * as awsx from "@pulumi/awsx";
import * as routes from "./api/routes/testing_routes";

const api = new awsx.apigateway.API("problematic", {
    routes: [
        { path: "/ping", method: "GET", eventHandler: routes.pingHandler }
    ],
})

export const apiUrl = api.url;
So everything seems fine but i get 500's on the gateway call. What's interesting is i did an initial deployment that was basically the "Creating a serverless REST API" from this page https://www.pulumi.com/serverless/ and everything worked fine. Then i tried sliding in this
/ping
route and moving that examples counter route to be at
/counter/{route+}
That's when the 500's started, so i actually destroyed the deployment, changed the api name as well, and regressed to just the ping route. The issue that's happening is all the roles and everything are being created, gateway is staging, deploying, etc. etc. But if i test the route from Resources tab on api-gateway it says there's a permission error. I have to go in to the
/ping - GET - integration request
settings and where the lambda function is set, just click in, and then click the checkmark. That makes the route able to invoke the lambda even though its the exact same name.
Hm so doing a route inline worked fine and seems to make my imported route work as well.
Now it doesn't seem to matter what i do everything works as expected. strange.