aws-samples / redcap-on-aws

Deploy REDCap (https://www.project-redcap.org/) on AWS with serverless resources
MIT No Attribution
13 stars 2 forks source link

Errors in REDCap Configuration Check #23

Closed tomotsuguseki closed 7 months ago

tomotsuguseki commented 7 months ago

After successful deployment to REDCap, I encountered the following two major configuration errors in REDCap. For the latter error, File Upload Settings page in the Control Center are filled with values.

Are they AWS or REDCap problem?

REDCap is not able to send emails - CRITICAL: It appears that your SMTP configuration (email-sending functionality) is either not set up or not configured correctly on the web server. It is HIGHLY recommended that you configure your email/SMTP server correctly in your web server's PHP.INI configuration file or else emails will not be able to be sent out from REDCap. REDCap requires email-sending capabilities for many vital application functions. For more details on configuring email-sending capabilities on your web server, visit PHP's mail configuration page.

File upload directory is NOT writable on Amazon S3 server - CRITICAL: It is HIGHLY recommended that you investigate your Amazon S3 connection info on the File Upload Settings page in the Control Center. REDCap is not able to successfully store files in the Amazon S3 bucket named "$amazon_s3_bucket". Please make sure all the connection values are correct and also that the directory is writable. Some functionality within REDCap will not be functional until files can be written to that bucket.

jl4nz commented 7 months ago

Hi, let guide you in these two issues:

Emails

Emails are configured to use Amazon SES. REDCap to check the config is valid tries to send an email to redcapemailtest@gmail.com. This mail is not allowed as an Identity in SES unless you put your SES in production mode.

To send emails, when SES is not in production, you can check your SES identities deployed by the project (generally a type Domain identity) and it should be in Verified status. You can use that domain to send emails.

The other use case is where the email configured in the deployment is sending email. You can manually add this identity as Email address type to validated it.

S3

I think this is just configuration detail of the previous deployments. You will need to rebuild your Docker image. For this you can execute the lambda or call it via CodeBuild

https://github.com/aws-samples/redcap-on-aws?tab=readme-ov-file#3-call-the-container-build-and-deploy-function

After the image is build again, it will update the S3 settings.

jl4nz commented 7 months ago

For Amazon SES, https://docs.aws.amazon.com/ses/latest/dg/creating-identities.html

jl4nz commented 7 months ago

It’s also worth mentioning that after the build command is executed , App Runner will take a few minutes to update with a Blue green deployment.

tomotsuguseki commented 7 months ago
  1. Email error was solved after production access was granted.
  2. S3 error didn't solved after re-deployment and re-build the image.

What action is needed for the S3 setting problem? Thanks for your help.

jl4nz commented 7 months ago

Hi! glad you could solve the email issue.

About the S3:

  1. Please use the latest v1.0.3 (no upgrade steps are required from v1.0.2). This ensure the database config are updated even if you change the credentials that access this S3 bucket.

  2. Please check that this file exist in your code containers/redcap-docker-apache/sql/redcapConfig.sql. If it doesn't exist, run the yarn command yarn gen redcap config

  3. Deploy and build the image again. Wait for AWS App runner to update.

Please check again in the REDCap config.

If is not working please check in the AWS Console / AppRunner and select your service, in the Configuration, you will see Runtime environment variables. Is there a variable there called S3_BUCKET with the value similar to prod-redcap-backend-appbucket...... ? This is to confirm the bucket exists and is passed to REDCap.

jl4nz commented 7 months ago

Please be sure that when you run the yarn gen redcap config be sure to select Yes to ✔ Use S3 bucket as storage for REDCap? · 1

tomotsuguseki commented 7 months ago

It worked well and now I have no major errors in the AWS configuration. Thanks for your help!