Skip to content

Conversation

brandonwatson
Copy link
Contributor

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)?

  • amplify-cli
  • amplify-ui
  • amplify-studio
  • amplify-hosting
  • [ X] amplify-libraries

Which platform(s) are affected by this PR (if applicable)?

  • JS
  • Swift
  • Android
  • Flutter
  • React Native

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

  • [ X] Ready to merge

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

@brandonwatson brandonwatson requested a review from a team as a code owner September 30, 2024 19:53
@josefaidt
Copy link
Contributor

Hey @brandonwatson 👋 thanks for taking the time to file this! It looks like a few yarn-specific config files were inadvertently committed, would you mind removing those? we can work with the team to add a packageManager key to prevent corepack from auto-adding one on install https://github.com/aws-amplify/docs/pull/8006/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R122

@brandonwatson brandonwatson deleted the update-lambda-triggers-doc branch September 30, 2024 21:30
@brandonwatson
Copy link
Contributor Author

Hey @brandonwatson 👋 thanks for taking the time to file this! It looks like a few yarn-specific config files were inadvertently committed, would you mind removing those? we can work with the team to add a packageManager key to prevent corepack from auto-adding one on install https://github.com/aws-amplify/docs/pull/8006/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R122

Updated with #8008

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants