Update lambda triggers doc #8006
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of changes:
I have updated the build-a-backend/storage/lambda-triggers documentation page based on my use of the functionality this past week as a developer. It was quite frustrating trying to use the docs as is to figure out how to modify the triggers, or even what was allowed.
As an solo-dev who is not super familiar with all of the cdk concepts which have been interwoven into gen 2 Amplify, I spent an inordinate amount of time trying to find a work around to the fact that the amplify FileUploader component uploads multiple files one at a time. If a customer is using this control in a modal dialog (for example) they are generally going to want an OK and CANCEL case. In my case, I wanted to trigger a lambda on OK. I went down a long and painful rabbit hole on how to trigger a lambda from the UX, and the prescribed method of adding a lambda on the schema actually breaks the backend build process if the lambda is being attached to storage. Then I went down the path of maybe having a REST API and spent hours on building that.
Before even testing it, I slept on it and thought more about how I might be able to accomplish what I want, which was to process all the files with my lambda in one go. This is a critical part of my specific use case. Triggering the lambda per file upload created race conditions etc. I solved this by uploading a manifest file from the dialog in my handleOK(). Having this file upload seemed like the right idea since there was a onUpload trigger. Sadly, the docs don't really explain that you can't do much in the way of modification to this trigger, which left me stuck again. I did more digging and eventually sorted out how to add an event notification via the backend.
This addition to the mdx would have saved me three days of coding.
FWIW, I cannot for the life of me figure out how to exclude all the files except the one mdx file change. Sorry!
Related GitHub issue #, if available:
Instructions
If this PR should not be merged upon approval for any reason, please submit as a DRAFT
Which product(s) are affected by this PR (if applicable)?
Which platform(s) are affected by this PR (if applicable)?
Please add the product(s)/platform(s) affected to the PR title
Checks
[Y ] Does this PR conform to the styleguide?
[ N] Does this PR include filetypes other than markdown or images? Please add or update unit tests accordingly.
[N ] Are any files being deleted with this PR? If so, have the needed redirects been created?
[ N] Are all links in MDX files using the MDX link syntax rather than HTML link syntax?
ref: MDX:
[link](https://docs.amplify.aws/)
HTML:
<a href="https://docs.amplify.aws/">link</a>
When this PR is ready to merge, please check the box below
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.