Skip to content

Commit

Permalink
Fix S3 credentials for AWS API V3
Browse files Browse the repository at this point in the history
  • Loading branch information
conoro committed Dec 4, 2023
1 parent 42e14a1 commit 0956f57
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions generate_bun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,15 @@ import { Database } from "bun:sqlite";
import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3";

// Retrieve AWS credentials from environment variables
const aws_access_key_id = process.env.EPA_RSS_ACCESS_KEY_ID;
const aws_secret_access_key = process.env.EPA_RSS_SECRET_ACCESS_KEY;
const S3Credentials = {
accessKeyId: process.env.EPA_RSS_ACCESS_KEY_ID,
secretAccessKey:process.env.EPA_RSS_SECRET_ACCESS_KEY,
}

const S3Config = {
region: 'eu-west-1',
S3Credentials,
}

// Set the S3 bucket details
const bucketName = process.env.EPA_RSS_BUCKET;
Expand Down Expand Up @@ -111,7 +118,8 @@ async function scrapeNewsAndUploadS3(urlbase: string) {
console.error("An PDF download error occurred:", error);
continue;
}
const s3Client = new S3Client({ region: "eu-west-1" });

const s3Client = new S3Client(S3Config);

const uploadParams = {
Bucket: bucketName,
Expand Down

0 comments on commit 0956f57

Please sign in to comment.