-
Notifications
You must be signed in to change notification settings - Fork 0
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
Move AWS secrets from .env
to lookit-api and add S3 error handling
#85
Conversation
…s from document, throw errors for expired credentials
…ase one of the uploadPart promises throws an error, and catch an ExpiredCredentials error from uploadPart in the completeUpload catch block
… and completeUpload
🦋 Changeset detectedLatest commit: 7fc4b24 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! Now that the environment variables have changed, you might want to update (or remove) the environment.d.ts file.
I want to get these updates into API, so I resolved the conflicts with "main" and removed "data"'s |
@okaycj these were very straightforward changes and I agree we need to get this merged ASAP, so thanks for getting it done! |
This PR moves the AWS S3 secrets for jsPsych video uploading out of an environment variable in the
data
package. They'll now be available to thedata
package via thelookit-api
(including in local development).The AWS secrets have also been changed to temporary credentials, so this adds checks and error handling for an 'expired token' error that can occur in response to any request sent to AWS S3.
List of changes
data
package.env
file to thelookit-api
. This means that the variables are obtained from the document at runtime, and we are no longer using thedotenv
package orprocess.env
indata
.MissingCredentials
error for when the AWS credentials are not found on the page.ExpiredCredentials
error for when the AWS credentials have expired.Important
This change to lookit-jspsych must be made in conjunction with the corresponding change in
lookit-api
, which adds the AWS secret temporary credentials into the jsPsych study template.To do
In the future we should change this to an API call. This will allow us to refresh the credentials if they expire during a session (assuming the user is logged in), instead of requiring the user to start a new session.