Skip to content
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

feat(trigger): Allow trigger to work with Lambda functions with long timeouts #23062

Merged
merged 11 commits into from Dec 16, 2022

Conversation

DerkSchooltink
Copy link
Contributor

@DerkSchooltink DerkSchooltink commented Nov 23, 2022

Implements #23058

All Submissions:

Adding new Unconventional Dependencies:

  • This PR adds new unconventional dependencies following the process described here

New Features

  • Have you added the new feature to an integration test?
    • Did you use yarn integ to deploy the infrastructure and generate the snapshot (i.e. yarn integ without --dry-run)?

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io
Copy link

gitpod-io bot commented Nov 23, 2022

@github-actions github-actions bot added valued-contributor [Pilot] contributed between 6-12 PRs to the CDK p2 labels Nov 23, 2022
@aws-cdk-automation aws-cdk-automation requested a review from a team November 23, 2022 16:10
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

@aws-cdk-automation aws-cdk-automation dismissed their stale review November 23, 2022 16:38

✅ Updated pull request passes all PRLinter validations. Dissmissing previous PRLinter review.

Copy link
Contributor

@corymhall corymhall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DerkSchooltink thanks for the PR! Just 2 minor comments.

packages/@aws-cdk/triggers/lib/trigger.ts Outdated Show resolved Hide resolved
@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

@mergify mergify bot dismissed corymhall’s stale review December 1, 2022 13:49

Pull request has been modified.

@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

packages/@aws-cdk/triggers/lib/trigger.ts Outdated Show resolved Hide resolved
Co-authored-by: Cory Hall <43035978+corymhall@users.noreply.github.com>
@mergify mergify bot dismissed corymhall’s stale review December 13, 2022 09:54

Pull request has been modified.

@mergify
Copy link
Contributor

mergify bot commented Dec 15, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify
Copy link
Contributor

mergify bot commented Dec 15, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@corymhall
Copy link
Contributor

@Mergifyio requeue

@mergify
Copy link
Contributor

mergify bot commented Dec 16, 2022

requeue

☑️ This pull request is already queued

@corymhall
Copy link
Contributor

@Mergifyio unqueue

@mergify
Copy link
Contributor

mergify bot commented Dec 16, 2022

unqueue

✅ The pull request has been removed from the queue

@corymhall
Copy link
Contributor

@Mergifyio requeue

@mergify
Copy link
Contributor

mergify bot commented Dec 16, 2022

requeue

✅ The queue state of this pull request has been cleaned. It can be re-embarked automatically

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 5e85681
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit 9fd3811 into aws:main Dec 16, 2022
@mergify
Copy link
Contributor

mergify bot commented Dec 16, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@DerkSchooltink DerkSchooltink deleted the feature/notriggertimeout branch December 19, 2022 09:15
comcalvi added a commit that referenced this pull request Jan 18, 2023
comcalvi added a commit that referenced this pull request Jan 19, 2023
mergify bot pushed a commit that referenced this pull request Jan 20, 2023
…23728)

Reverts #23062.

#23062 introduced #23407, which causes lambda functions that use triggers to fail to invoke with either this error

```
submit response to cloudformation {
  Status: 'FAILED',
  Reason: `TypeError [ERR_INVALID_ARG_TYPE]: The "msecs" argument must be of type number. Received type string ('120000')\n` +
    '    at new NodeError (internal/errors.js:322:7)\n' +
    '    at validateNumber (internal/validators.js:129:11)\n' +
    '    at getTimerDuration (internal/timers.js:384:3)\n' +
    '    at ClientRequest.setTimeout (_http_client.js:865:11)\n' +
    '    at features.constructor.handleRequest (/var/runtime/node_modules/aws-sdk/lib/http/node.js:82:12)\n' +
    '    at executeSend (/var/runtime/node_modules/aws-sdk/lib/event_listeners.js:370:29)\n' +
    '    at Request.SEND (/var/runtime/node_modules/aws-sdk/lib/event_listeners.js:384:9)\n' +
    '    at Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:102:18)\n' +
    '    at Request.emit (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:78:10)\n' +
    '    at Request.emit (/var/runtime/node_modules/aws-sdk/lib/request.js:686:14)',
  StackId: 'arn:aws:cloudformation:us-east-1:***:stack/TestStack/83f77790-806c-11ed-8956-0a55d38b49ed',
  RequestId: '86a74312-347d-40c4-873a-09eed5b8eddd',
  PhysicalResourceId: 'AWSCDK::CustomResourceProviderFramework::CREATE_FAILED',
  LogicalResourceId: 'Trigger',
  NoEcho: undefined,
  Data: undefined
}
```

or

```
Error: Trigger handler failed with status code 202 at handler (/var/task/index.js:53:15) at processTicksAndRejections (internal/process/task_queues.js:95:5) at async Runtime.handler (/var/task/__entrypoint__.js:32:24) (RequestId: ab252a7a-e06b-4fcf-b2b4-f59b2dd88734)
```

Reverting for now, since people are unable to upgrade. 

To unblock this revert, I'm disabling the integration test `dependencies-pnpm`, because when running it locally (and in this PR build) the logical ID of the version changes every run. This has been reproduced by others locally, so it's being disabled until we can resolve that issue.

Fixes #23407
comcalvi added a commit that referenced this pull request Jan 20, 2023
…23728)

Reverts #23062.

#23062 introduced #23407, which causes lambda functions that use triggers to fail to invoke with either this error

```
submit response to cloudformation {
  Status: 'FAILED',
  Reason: `TypeError [ERR_INVALID_ARG_TYPE]: The "msecs" argument must be of type number. Received type string ('120000')\n` +
    '    at new NodeError (internal/errors.js:322:7)\n' +
    '    at validateNumber (internal/validators.js:129:11)\n' +
    '    at getTimerDuration (internal/timers.js:384:3)\n' +
    '    at ClientRequest.setTimeout (_http_client.js:865:11)\n' +
    '    at features.constructor.handleRequest (/var/runtime/node_modules/aws-sdk/lib/http/node.js:82:12)\n' +
    '    at executeSend (/var/runtime/node_modules/aws-sdk/lib/event_listeners.js:370:29)\n' +
    '    at Request.SEND (/var/runtime/node_modules/aws-sdk/lib/event_listeners.js:384:9)\n' +
    '    at Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:102:18)\n' +
    '    at Request.emit (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:78:10)\n' +
    '    at Request.emit (/var/runtime/node_modules/aws-sdk/lib/request.js:686:14)',
  StackId: 'arn:aws:cloudformation:us-east-1:***:stack/TestStack/83f77790-806c-11ed-8956-0a55d38b49ed',
  RequestId: '86a74312-347d-40c4-873a-09eed5b8eddd',
  PhysicalResourceId: 'AWSCDK::CustomResourceProviderFramework::CREATE_FAILED',
  LogicalResourceId: 'Trigger',
  NoEcho: undefined,
  Data: undefined
}
```

or

```
Error: Trigger handler failed with status code 202 at handler (/var/task/index.js:53:15) at processTicksAndRejections (internal/process/task_queues.js:95:5) at async Runtime.handler (/var/task/__entrypoint__.js:32:24) (RequestId: ab252a7a-e06b-4fcf-b2b4-f59b2dd88734)
```

Reverting for now, since people are unable to upgrade. 

To unblock this revert, I'm disabling the integration test `dependencies-pnpm`, because when running it locally (and in this PR build) the logical ID of the version changes every run. This has been reproduced by others locally, so it's being disabled until we can resolve that issue.

Fixes #23407
brennanho pushed a commit to brennanho/aws-cdk that referenced this pull request Jan 20, 2023
…timeouts (aws#23062)

Implements aws#23058
----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [x] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
brennanho pushed a commit to brennanho/aws-cdk that referenced this pull request Feb 22, 2023
…timeouts (aws#23062)

Implements aws#23058
----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [x] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
mergify bot pushed a commit that referenced this pull request Apr 5, 2023
…timeouts (#24435)

Reopened PR from #23650 and #23788

And re-revert from #23062 ([v2.61.1](https://github.com/aws/aws-cdk/releases/tag/v2.61.1))

Implements #23058 and fixes #23407

Worked on comments from @TheRealAmazonKendra as well. Added an integration test scenario where a Lambda function will be triggered by a Trigger construct, send a message to an SQS queue, which will be consumed by the integration test assertion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2 valued-contributor [Pilot] contributed between 6-12 PRs to the CDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants