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.
What Changed & Why
After the update to AWS SDK v3 when searching for a revision the Contents on the response is not present if the revision hasn't been created yet. This seemed like the smallest change to fix the problem, and optional chaining is supported in Node 14, but I had to bump up the ecmaVersion in the eslint config to allow it.
Without this our deployed after updating to v4.0.1 have the error
TypeError: Cannot read properties of undefined (reading 'find') at [email protected]/node_modules/ember-cli-deploy-s3-index/lib/s3.js:169:45
Debugging this method, my response from AWS looks like:
I wasn't able to find anything in the AWS upgrade notes or in the API docs that explains this difference which is why I made the changes so small and didn't attempt to check if
Contents
exists or count the responses instead. I'm happy to do this another way if someone is more familiar with the S3 API calls here.Related issues
#138
PR Checklist
People
@lukemelia @saravanak