Skip to content

Commit

Permalink
feat: adding info log
Browse files Browse the repository at this point in the history
  • Loading branch information
dipratap committed Sep 2, 2024
1 parent 531852f commit 7152b50
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/metatags/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ import SeoChecks from './seo-checks.js';
async function fetchAndProcessPageObject(s3Client, bucketName, key, prefix, log) {
const object = await getObjectFromKey(s3Client, bucketName, key, log);
if (!object?.scrapeResult?.tags || typeof object.scrapeResult.tags !== 'object') {
log.error(`No Scraped tags found in S3 ${key} object, body ${JSON.stringify(object)}`);
if (object && object.scrapeResult) {
log.error(`No Scraped tags found in S3 ${key} object, body ${JSON.stringify(object)} & type ${typeof object.scrapeResult.tags}`);
} else {
log.error(`No Scraped tags found in S3 ${key} object, body ${JSON.stringify(object)}`);
}
return null;
}
const pageUrl = key.slice(prefix.length - 1).replace('scrape.json', ''); // Remove the prefix and .json suffix
Expand Down
4 changes: 3 additions & 1 deletion test/audits/metatags.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,9 @@ describe('Meta Tags', () => {
.returns({
Body: {
transformToString: () => JSON.stringify({
tags: 5,
scrapeResult: {
tags: 5,
},
}),
},
});
Expand Down

0 comments on commit 7152b50

Please sign in to comment.