Skip to content

Commit

Permalink
Update to newest aws chrome layer (#27)
Browse files Browse the repository at this point in the history
* Update to newest aws chrome layer

If you take a look at https://github.com/shelfio/chrome-aws-lambda-layer/#getting-started you will see the newest chrome layer has an updated require statement (this began in version 26 as you can see here: shelfio/chrome-aws-lambda-layer@02f73fe#diff-5a831ea67cf5cf8703b0de46901ab25bd191f56b320053be9332d9a3b0d01d15R18)

* Updating layer in PHP

* Use @sparticuz/chrome-aws-lambda in modifiedBrowserJs

Co-authored-by: Stefan Zweifel <[email protected]>
  • Loading branch information
bryanjamesmiller and stefanzweifel authored Aug 14, 2022
1 parent 85d2221 commit 3a93c9f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion resources/lambda/browsershot.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const fs = require('fs');
const { execSync } = require('child_process');
const chromium = require('chrome-aws-lambda');
const chromium = require('@sparticuz/chrome-aws-lambda');
const AWS = require('aws-sdk');

exports.handle = async function (event) {
Expand Down
4 changes: 2 additions & 2 deletions src/Functions/BrowsershotFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected function modifiedBrowserJs()
$browser = str_replace('const puppet = (pup || require(\'puppeteer\'));', '', $browser);

// Add ours.
return "const puppet = require('chrome-aws-lambda').puppeteer; \n" . $browser;
return "const puppet = require('@sparticuz/chrome-aws-lambda').puppeteer; \n" . $browser;
}

public function runtime()
Expand All @@ -75,6 +75,6 @@ public function layers()
$region = config('sidecar.aws_region');

// https://github.com/shelfio/chrome-aws-lambda-layer
return ["arn:aws:lambda:{$region}:764866452798:layer:chrome-aws-lambda:25"];
return ["arn:aws:lambda:{$region}:764866452798:layer:chrome-aws-lambda:31"];
}
}

0 comments on commit 3a93c9f

Please sign in to comment.