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

Fix #784 Add built-in AwsLambdaReceiver #785

Merged
merged 2 commits into from
Feb 25, 2021

Conversation

seratch
Copy link
Member

@seratch seratch commented Feb 9, 2021

Summary

This pull request fixes #784 - see the issue for details.

Requirements (place an x in each [ ])

@seratch seratch added the enhancement M-T: A feature request for new functionality label Feb 9, 2021
@seratch seratch self-assigned this Feb 9, 2021
@codecov
Copy link

codecov bot commented Feb 9, 2021

Codecov Report

Merging #785 (149847d) into main (3b7ae8a) will increase coverage by 0.44%.
The diff coverage is 59.49%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #785      +/-   ##
==========================================
+ Coverage   65.59%   66.04%   +0.44%     
==========================================
  Files          12       13       +1     
  Lines        1093     1172      +79     
  Branches      323      342      +19     
==========================================
+ Hits          717      774      +57     
- Misses        317      333      +16     
- Partials       59       65       +6     
Impacted Files Coverage Δ
src/receivers/AwsLambdaReceiver.ts 59.49% <59.49%> (ø)
src/App.ts 83.63% <0.00%> (+3.03%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3b7ae8a...b3d216f. Read the comment docs.

@seratch
Copy link
Member Author

seratch commented Feb 9, 2021

I can improve the code coverage. Any reviews / comments would be appreciated.

Copy link
Member

@mwbrooks mwbrooks left a comment

Choose a reason for hiding this comment

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

Very nice!

I left a small nit to rename a type, but it's your choice on the naming convention.

🧠 I wonder curious, if it's possible to automatically apply the processBeforeResponse setting in the AwsLambdaReceiver? Or perhaps, we can set it to true when it's undefined? That way the developer can still disable it if they have a reason.

src/receivers/AwsLambdaReceiver.ts Outdated Show resolved Hide resolved
src/receivers/AwsLambdaReceiver.ts Outdated Show resolved Hide resolved
src/receivers/AwsLambdaReceiver.ts Outdated Show resolved Hide resolved
@seratch
Copy link
Member Author

seratch commented Feb 10, 2021

if it's possible to automatically apply the processBeforeResponse setting in the AwsLambdaReceiver? Or perhaps, we can set it to true when it's undefined? That way the developer can still disable it if they have a reason.

I am not really sure if there is a certain situation where a developer need to disable it for apps on FaaS. It does not work without exception (am I missing something?)

The reason why this receiver is quite simple is that we do not have the flag. It's possible to have the flag but it will make the code unnecessarily complex.

@seratch seratch force-pushed the issue-784-aws-lambda-receiver branch 2 times, most recently from 08104a1 to 8f00c79 Compare February 10, 2021 15:51
@mwbrooks
Copy link
Member

I am not really sure if there is a certain situation where a developer need to disable it for apps on FaaS. It does not work without exception (am I missing something?)

The reason why this receiver is quite simple is that we do not have the flag. It's possible to have the flag but it will make the code unnecessarily complex.

After This morning, I realized that processBeforeResponse is part of ExpressReceiver and not App. When I wrote the review, I thought the flag was part of Bolt's App. So, you can totally disregard my comment! My mistake.

@seratch
Copy link
Member Author

seratch commented Feb 10, 2021

We may want to update https://github.com/slackapi/bolt-js/tree/main/examples/deploy-aws-lambda once we release this receiver.

@CLAassistant
Copy link

CLAassistant commented Feb 11, 2021

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@stevengill stevengill left a comment

Choose a reason for hiding this comment

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

Looks great Kaz! I'd say lets merge this in create an issue to write some documentation for it. We may want to hold off updating the official lambda deployment guide until we reach feature parity with ExpressReceiver (like OAuth support).

Also, great tests

logLevel?: LogLevel;
}

export interface AwsLambdaReceiverInstallerOptions {
Copy link
Member

Choose a reason for hiding this comment

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

@seratch I don't see you using installPath or redirectUriPath. Did you add them because you wanted to implement OAuth but decided against it? For now, the recommendation is if you want OAuth, use ExpressReceiver

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, thanks for pointing this out! Yes, I was going to implement OAuth flow too but, as I mentioned in the issue, @slack/oauth module is not for this receiver at this point. I will remove this interface and add some comments why OAuth is not yet supported before merging this PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

Resolved this.

@seratch seratch force-pushed the issue-784-aws-lambda-receiver branch from eb8e5a3 to a383fee Compare February 15, 2021 03:17
@seratch
Copy link
Member Author

seratch commented Feb 15, 2021

Now this PR is ready to merge.

@seratch seratch force-pushed the issue-784-aws-lambda-receiver branch from 5046859 to f5a32d3 Compare February 24, 2021 05:22
@seratch seratch force-pushed the issue-784-aws-lambda-receiver branch from f5a32d3 to 733d28a Compare February 24, 2021 05:23
@mwbrooks
Copy link
Member

Thanks @seratch! I'll merge this PR now.

I'll create a separate issue (unless we already have one) to add an example of AWSLambdaReceiver. We should not update our examples/deploy-aws-lambda until we update the deployment guide, because the guide references the example.

Regardless, it would be great to have examples of both methods - using the AwsLambdaReceiver and using the ExpressReceiver/Serverless express combo.

@mwbrooks mwbrooks merged commit 658f6f4 into slackapi:main Feb 25, 2021
@seratch seratch deleted the issue-784-aws-lambda-receiver branch February 25, 2021 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement M-T: A feature request for new functionality semver:minor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add built-in AwsLambdaReceiver
4 participants