Ghost AWS S3 'Internal server error, cannot upload image'

Hi all,

I am in the process of adding a aws s3 storage adapter to my ghost config in ubuntu. Unfortunately, I get a ‘Internal server error, cannot upload image’ error after restarting ghost with the new configuration.

I have followed this guide on Ghost storage adapter S3 and I also read the support page on the signature version for london-based (eu-west-2) buckets which I didn’t really understand.

This is my current configuration:

"storage": {
 "active": "s3",
 "s3": {
   "accessKeyId": "My_accessKeyId",
   "secretAccessKey": "My_secretAccessKey",
   "region": "eu-west-2",
   "bucket": "arn:aws:s3:::my-bucket-name",
   "forcePathStyle": true,
   "signatureVersion": "v4"
 }
},

Is this an error related to the signature version? how do I solve it? Thanks in advance!

1 Like

I found this information on signature versions (see documentation here) but I still get the same error when changing the Signature Version to AWS4-HMAC-SHA256 for regions that support version 4.

I even created a new bucket in Ireland and followed the guide again using both “AWS” and “AWS4-HMAC-SHA256” as signature versions but still does not work

I have Ghost hosted in AWS Lightsail and I did not have to add this step in the configuration anymore

hi @Jesus_Esquivel_Roman ,
i’m also hosting my ghost instance in lightsail, and would like to add this s3 adapter too.
per your last post, you mean you’re not even using this adapter anymore ? and have all files uploaded storaged in the lightsail instance locally ?

yes, I am using this adapter and I have all the files stored in AWS S3. So after you deploy the instance and assign an static IP to it and add it to your domain, you want to create a CDN distribution in AWS Cloudfront and a S3 bucket outside of Lightsail as outline in GitHub - colinmeinke/ghost-storage-adapter-s3: An AWS S3 storage adapter for Ghost.

You will then need to install the s3 adapter in your instance:

  1. cd /bitnami/ghost which is where ghost is installed
  2. sudo npm install ghost-storage-adapter-s3 to install the s3 storage adapter for ghost
  3. sudo mkdir -p /bitnami/ghost/content/adapters/storage to create a folder for the s3 storage
  4. sudo cp -r ./node_modules/ghost-storage-adapter-s3 ./content/adapters/storage/s3 to copy the folder
  5. cd ./content/adapters/storage/s3 to switch directory
  6. sudo npm install to install the adapter in the new folder

After you have done that, you need to configure the .json file:

  1. Go to the config.production.json in the server ( sudo nano /bitnami/ghost/config.production.json )
  2. Edit URL, mail, and storage as discussed in the Ghost config documentation Configuration - Adapt your publication to suit your needs
  3. sudo /opt/bitnami/ctlscript.sh restart to restart the services
  4. Test the ghost webpage (emails, photo storage and blog access) to verify that everything is working well

Also, make sure you enable SSL and HTTPS. See bitnami guides on how to do this Ghost packaged by Bitnami

1 Like

hi @Jesus_Esquivel_Roman ,

thanks for your very detailed reply.

'cause i already have quite a few posts published in my ghost setup, do you know if this adpater is installed, will it break every existing posts ? or will it be effective only on new posts after the installation ?

It shouldn’t break anything. New images and/or files will be saved in S3 after you install the adapter. Either way I recommend you do an backup/export of your current blogs from Settings > Labs as well as saving the images used in your blos in a temporary folder in your computer just in case

1 Like