Skip to content

Commit 6f1de20

Browse files
committed
Explicitly set region for AWS S3 publishing
Fixes the following error: `Error: Region is missing`
1 parent d025292 commit 6f1de20

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@ jobs:
3434
npm run publish:aws
3535
env:
3636
S3_BUCKET_NAME: 'builds.handlebarsjs.com'
37+
S3_REGION: 'us-east-1'
3738
S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
3839
S3_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}

tasks/publish-to-aws.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ async function main() {
3535

3636
function validateS3Env() {
3737
const bucket = process.env.S3_BUCKET_NAME,
38+
region = process.env.S3_REGION,
3839
key = process.env.S3_ACCESS_KEY_ID,
3940
secret = process.env.S3_SECRET_ACCESS_KEY;
4041

41-
if (!bucket || !key || !secret) {
42+
if (!bucket || !region || !key || !secret) {
4243
throw new Error('Missing S3 config values');
4344
}
4445
}
@@ -79,6 +80,7 @@ async function uploadToBucket(localFile, nameInBucket) {
7980
function getS3Client() {
8081
if (!s3Client) {
8182
s3Client = new S3({
83+
region: process.env.S3_REGION,
8284
credentials: {
8385
accessKeyId: process.env.S3_ACCESS_KEY_ID,
8486
secretAccessKey: process.env.S3_SECRET_ACCESS_KEY,

0 commit comments

Comments
 (0)