New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An error occurred: ApiGatewayDeploymentxxxxx - No integration defined for method - when v1.28 was used #5100

Closed
densbozz opened this Issue Jul 6, 2018 · 16 comments

Comments

Projects
None yet
10 participants
@densbozz
Copy link

densbozz commented Jul 6, 2018

This is a (Bug Report)

This error started July 4 and coincidentally 1.28.0 was released.
our CodeBuild is failing since then.

In our CodeBuild spec...

------------------------ code build spec ---------------

version: 0.2

phases:
install:
commands:
- ls -a
- npm install -g serverless
build:
commands:
- npm install --only=dev
post_build:
commands:
- serverless deploy --stage $APP_DEPLOYMENT_ENVIRONMENT --package serverless


Description

For bug reports:

  • What went wrong? - CodeBuild failed. This also impacted our update on existing API G where it somehow deleted method (OPTIONS) on some api endpoints.
  • What did you expect should have happened? - our build was successful before, there are no other config or yml changes implemented except on business application code.
  • What was the config you used? - no update on config
  • What stacktrace or error message from your provider did you see?

Additional Data - Error Stack in Code Build

Serverless: Checking Stack update progress...
....................................................................................................................................
Serverless: Operation failed!

Serverless Error ---------------------------------------

An error occurred: ApiGatewayDeploymentxxxxxxx - No integration defined for method (Service: AmazonApiGateway; Status Code: 400; Error Code: BadRequestException; Request ID: xxxxxxxxxxxxxxxxxxx).

Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com

Your Environment Information -----------------------------
OS: linux
Node Version: 6.3.1
Serverless Version: 1.27.3

[Container] 2018/07/06 04:46:55 Command did not exit successfully serverless deploy --stage $APP_DEPLOYMENT_ENVIRONMENT --package serverless exit status 1
[Container] 2018/07/06 04:46:55 Phase complete: POST_BUILD Success: false
[Container] 2018/07/06 04:46:55 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: serverless deploy --stage $APP_DEPLOYMENT_ENVIRONMENT --package serverless. Reason: exit status 1

@drexler

This comment has been minimized.

Copy link
Contributor

drexler commented Jul 6, 2018

@densbozz the output references that you're still using v1.27.3. That rules out the newer version as a probable cause.

@mitchell

This comment has been minimized.

Copy link

mitchell commented Jul 7, 2018

@densbozz @drexler I was experiencing the same issue, the exact same error output and resources missing the OPTIONS method. It appears to be related to a change in 1.28.0, because when deploying after the switch there are create method events being output in the event log despite no changes to my configuration.

It seems like serverless was attempting to create OPTIONS methods that were already existent.

I was able to resolve it by removing cors: true from all of my API Gateway resources in my serverless.yml, deploying, then adding cors: true back and deploying once more. I would presume that setting cors: false instead of removing/commenting them out would also suffice.

If this doesn't work and the problem is being more persistent, I was able to resolve the issue on one of my service's stages by removing all lambdas with http events (alternatively you can fully remove the service) from your serverless config, deploying, replacing, and deploying once again.

@densbozz

This comment has been minimized.

Copy link

densbozz commented Jul 10, 2018

@mitchelljfs - thanks for the response. this makes sense now. can you confirm the workaround you did is just one time, and your succeeding serverless deployments have been successful?

@mitchell

This comment has been minimized.

Copy link

mitchell commented Jul 10, 2018

@densbozz no problem. I have not run into the problem more than once per stage, after using one of the two methods I described. So, yes.

@horike37 horike37 added this to the 1.28.1 milestone Jul 10, 2018

@dschep

This comment has been minimized.

Copy link
Member

dschep commented Jul 10, 2018

We're also experiencing this issue. The workaround is less than ideal, so hopefully this'll be resolved in 1.28.1

@skylarmb

This comment has been minimized.

Copy link

skylarmb commented Jul 16, 2018

simply removing cors: true from my http events didn't seem to do it.

What solved it for me was deleting all my http events (except for one test event so that an API Gateway deployment would still be created), deploying, restoring all http events, deploying again. NOTE: It appears this completely re-creates the Lambda function instead of just updating it as all settings (environment variables, VPCs, roles, etc) were lost, which doesn't happen on a normal deploy.

@horike37 horike37 modified the milestones: 1.28.1, 1.29.1 Jul 26, 2018

@pmuens

This comment has been minimized.

Copy link
Member

pmuens commented Aug 25, 2018

Hey @densbozz @drexler @mitchelljfs @dschep and @skylarmb!
Thanks for reporting and discussing solutions for this issue 👍

So I tried to reproduce this today with the following (super simple) service:

service: regression

provider:
  name: aws
  runtime: nodejs6.10

functions:
  hello:
    handler: handler.hello
    events:
      - http:
          path: test
          method: POST
          cors: true

I started with a deployment via 1.27.3, after that I re-deployed (still using 1.27.3). Then I updated to 1.28.0 and re-deployed again. Unfortunately I'm not able to trigger the described error. I'm pretty sure that there might be something more I need to configure on the API Gateway end to force the error to pop up.

Can anyone of you share a simple (redacted) serverless.yml so that we can reproduce this on our end? Thanks in advance!

@skylarmb

This comment has been minimized.

Copy link

skylarmb commented Aug 27, 2018

@pmuens here is a redacted version of our serverless.yml. We have many more http and scheduled events than these but this is just a sample

plugins:
  - serverless-apigw-binary
  - serverless-api-stage
  - serverless-plugin-split-stacks
  - serverless-offline

service: my-service
package:
  exclude:
    - ".env"
    - "coverage/**"
    - "test/**"
    - "scripts/**"
    - "ddl/**"
    - "docs/**"
    - "./*.json"
provider:
  timeout: 300
  name: aws
  runtime: nodejs8.10
  stage: ${opt:stage}
  region: us-east-1
  profile: foobar
  role: arn:aws:iam::123456789000:role/foobar-api-executor
  apiKeys:
    - ${opt:stage}-someApiKey
custom:
  apigwBinary:
    types:
      - 'application/octet-stream'
      - 'application/pdf'
  stageSettings:
    MethodSettings:
        DataTraceEnabled: true
        HttpMethod: "*"
        LoggingLevel: INFO
        ResourcePath: "/*"
        MetricsEnabled: true
  development:
    eventsEnabled: true
functions:
  root:
    handler: index.proxyRouter
    events:
      - schedule:
          name: 'X${opt:stage}SomeEventName'
          rate: cron(0 13 ? * MON *)
          enabled: ${self:custom.${opt:stage}.eventsEnabled}
          input:
            name: 'someEventName'
            stage: ${opt:stage}
      - http:
          cors: true
          method: get
          path: /api/baz
          authorizer:
            arn: ${file(./.serverless.env.yml):COGNITO_POOL_ARN}
      - http:
          cors: true
          method: post
          path: '/api/public/{id}/qux'

@hadolphs

This comment has been minimized.

Copy link

hadolphs commented Aug 27, 2018

We just updated from version 1.26.1 (pretty old...) to version 1.30.1 and we just this same problem with our http event driven lambdas... This happens when attempting to create the web hook:
No integration defined for method (Service: AmazonApiGateway; Status Code: 400; Error Code: BadRequestException; Request ID: ******some ID*******

@hadolphs

This comment has been minimized.

Copy link

hadolphs commented Aug 27, 2018

We tried redeploying with cors=true commented and then redeploying uncommenting it again in our lambdas and it worked... in case you guys are wondering if the workaround works. It worked for us at least in some of our lambdas, still need to try it in all our others. Will report here if we experience something different. Thanks

@pmuens pmuens referenced this issue Aug 28, 2018

Merged

Fix CORS race condition #5256

5 of 5 tasks complete

@pmuens pmuens modified the milestones: 1.29.1, 1.31.0 Aug 28, 2018

@pmuens

This comment has been minimized.

Copy link
Member

pmuens commented Aug 28, 2018

Hey everyone!
Thanks for getting back with more information about the issue at hand 👍

We think we finally figured out why this happens. We've provided a fix via #5256 and test it thoroughly right now.

@pmuens pmuens removed this from the 1.31.0 milestone Aug 28, 2018

@pmuens pmuens closed this in #5256 Aug 28, 2018

@pmuens

This comment has been minimized.

Copy link
Member

pmuens commented Aug 29, 2018

Hey everyone!

This issue has been fixed via #5256 and is now available in v1.30.3.

@shevaul

This comment has been minimized.

Copy link

shevaul commented Nov 17, 2018

Hi Everyone,

We run into the same issue first time today with v1.32.0, we do an update to v1.33.1 and the issue is still there. It does not work for us by commenting all "cors" trick.
Anyone also encounter this with v1.32.0 and after

Here is our log:
Serverless: Packaging service...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service .zip file to S3 (11.13 MB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
......................................................
Serverless: Operation failed!

Serverless Error ---------------------------------------

An error occurred: ApiGatewayDeployment1542460698067 - No integration defined for method (Service: AmazonApiGateway; Status Code: 400; Error Code: BadRequestException; Request ID: 55678d9d-ea6b-11e8-b095-5f8066d9233c).

Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com

Your Environment Information -----------------------------
OS: darwin
Node Version: 8.12.0
Serverless Version: 1.33.1

@shevaul

This comment has been minimized.

Copy link

shevaul commented Nov 17, 2018

Hi Everyone,

We run into the same issue first time today with v1.32.0, we do an update to v1.33.1 and the issue is still there. It does not work for us by commenting all "cors" trick.
Anyone also encounter this with v1.32.0 and after

Here is our log:
Serverless: Packaging service...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service .zip file to S3 (11.13 MB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
......................................................
Serverless: Operation failed!

Serverless Error ---------------------------------------

An error occurred: ApiGatewayDeployment1542460698067 - No integration defined for method (Service: AmazonApiGateway; Status Code: 400; Error Code: BadRequestException; Request ID: 55678d9d-ea6b-11e8-b095-5f8066d9233c).

Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com

Your Environment Information -----------------------------
OS: darwin
Node Version: 8.12.0
Serverless Version: 1.33.1

Sorry folks. This is a false alarm and does not related serverless framework.
I will leave the post here just in case someone also run into this.
The error is about API Gateway itself but has nothing to do with serverless.
The issue is there is some API missing unintegrated method (say no lambda assigned to that API), so the API is not complete.
Please see the following post for reference:
https://stackoverflow.com/questions/46087890/no-integration-defined-for-method-choose-a-stage-where-your-api-will-be-deploy

@dschep

This comment has been minimized.

Copy link
Member

dschep commented Nov 20, 2018

Thanks for following up with the root cause of your issue @shevaul 👍

@arvindnarang

This comment has been minimized.

Copy link

arvindnarang commented Dec 13, 2018

Hi All ,
I am facing An error occurred: ApiGatewayDeploymentxxxxxxxxxx - No integration defined for method (Service: AmazonApiGateway; Status Code: 400; Error Code: BadRequestException; Request ID: xxxxxxx-xxxxxxxx) issue and my vesion is 1.32.0 .. Any help will be much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment