diff --git a/packages/prerender-fargate/lib/recaching/prerender-recache-api-construct.api.ts b/packages/prerender-fargate/lib/recaching/prerender-recache-api-construct.api.ts index d404c222..7b536485 100644 --- a/packages/prerender-fargate/lib/recaching/prerender-recache-api-construct.api.ts +++ b/packages/prerender-fargate/lib/recaching/prerender-recache-api-construct.api.ts @@ -202,6 +202,10 @@ const queueRecachineUrls = async (urlsToRecache: string[]) => { Entries: urls.map(generateEntry), }); }); + console.log(`Queuing messages for SQS`, { + urlsToRecache: urlsToRecache[0], + messageEntries: messages[0].input.Entries, + }); console.log(`Sending ${messages.length} recaching message batches`); diff --git a/packages/prerender-fargate/lib/recaching/prerender-recache-api-construct.consumer.ts b/packages/prerender-fargate/lib/recaching/prerender-recache-api-construct.consumer.ts index 58ddbaef..872dd266 100644 --- a/packages/prerender-fargate/lib/recaching/prerender-recache-api-construct.consumer.ts +++ b/packages/prerender-fargate/lib/recaching/prerender-recache-api-construct.consumer.ts @@ -1,4 +1,4 @@ -import { Context, SQSEvent, SQSRecord } from "aws-lambda"; +import { Context, SQSEvent } from "aws-lambda"; import axios from "axios"; const userAgent = "prerender / Googlebot recaching request"; @@ -9,13 +9,16 @@ const userAgent = "prerender / Googlebot recaching request"; * @param context - The AWS Lambda context object. */ export const handler = async (event: SQSEvent, _context: Context) => { - event.Records.forEach(async (record: SQSRecord) => { + for (const record of event.Records) { const url = record.body; console.log(`Fetching ${url} for recaching`); - await axios.get(url, { + const res = await axios.get(url, { headers: { "User-Agent": userAgent, }, }); - }); + console.log( + `Fetched URL: ${url}, Response Code: ${JSON.stringify(res.status)}` + ); + } };