https://pulumi.com logo
Title
r

rough-jordan-15935

11/24/2022, 6:55 AM
another big question is, when i use api gateway (AWS) and deploy with a new resource. the entire api gateway goes down and says “unexpected token e error” and cannot invoke any lambda. it needs a second deployment to fix
l

limited-rainbow-51650

11/24/2022, 6:57 AM
Can you share the code which sets up the API Gateway?
r

rough-jordan-15935

11/24/2022, 6:58 AM
sure
const apigateway = new awsx.apigateway.API('api-gateway', {
  routes,
  restApiArgs: {
    binaryMediaTypes: []
  }
});
export const routes: awsx.apigateway.Route[] = [
  {
    path: 'route/',
    method: 'GET',
    eventHandler: callbackFunction,
  },]
l

limited-rainbow-51650

11/24/2022, 7:06 AM
Can you also post the full console output when the error occurs, also with
pulumi about
output?
r

rough-jordan-15935

11/24/2022, 7:07 AM
its not an error like that. it is an error that happens inside the lambda function invoked by the API Gateway
the second deployment fixes it
Error
ERROR Invoke Error {"errorType":"SyntaxError","errorMessage":"Unexpected token e in JSON at position 0"
l

limited-rainbow-51650

11/24/2022, 7:09 AM
What is Pulumi changing to the infrastructure on the second deployment? Do you have output of that you can paste?
r

rough-jordan-15935

11/24/2022, 7:10 AM
it changes the api gateway stage and deployment
yes lemme check
l

limited-rainbow-51650

11/24/2022, 7:12 AM
which version of
awsx
package are you using?
r

rough-jordan-15935

11/24/2022, 7:12 AM
“@pulumi/awsx”: “^0.30.0", this is it
im having some trouble sending the output beacuse the deployment seems to be taking some time, but
it changes the api gateway stage and deployment
doe this help?
l

limited-rainbow-51650

11/24/2022, 7:13 AM
That is an old one. Could you first bump to the latest version, which is v1.0.0-beta.11? https://www.pulumi.com/registry/packages/awsx/
r

rough-jordan-15935

11/24/2022, 7:14 AM
the beta? is there any stable one?
l

limited-rainbow-51650

11/24/2022, 7:14 AM
Yes, I see we just released 1.0.0 https://github.com/pulumi/pulumi-awsx/releases
r

rough-jordan-15935

11/24/2022, 7:14 AM
lemme bump to that and see
l

limited-rainbow-51650

11/24/2022, 7:15 AM
It’s possible you have to update your code because there is a big difference between the 0.xx version range and the 1.0 one.
r

rough-jordan-15935

11/24/2022, 7:15 AM
lemme check
yeah seems i have to change my entire api gateway structure