I'm trying to store images from my Node.js Backend to an AWS S3 Bucket. The app is hosted on heroku. This works perfectly fine in my local environment but once I deploy the app to heroku with gitlab CI/CD, I get the following error:
Missing credentials in config, if using AWS_CONFIG_FILE, set
AWS_SDK_LOAD_CONFIG=1","errno":"ECONNREFUSED","code":"CredentialsError","syscall":"connect"
On my local environment I store the API Keys in an .env file like this:
BUCKET_NAME=XYZ
AWS_KEY_ID=XYZ
AWS_ACCESS_KEY=XYZ
and my Node server gets the variables like this:
const s3 = new AWS.S3({
accessKeyId: process.env.AWS_KEY_ID,
secretAccessKey: process.env.AWS_ACCESS_KEY
});
const BUCKET_NAME = process.env.BUCKET_NAME
This works in my local environment. On Gitlab, I store the same variables with the exact same names
but I get the above error when I try to store a file.