{"id":15481154,"url":"https://github.com/chriszarate/pwmetrics-lambda","last_synced_at":"2025-04-22T15:23:57.673Z","repository":{"id":143904021,"uuid":"113812641","full_name":"chriszarate/pwmetrics-lambda","owner":"chriszarate","description":"Run pwmetrics on AWS Lambda","archived":false,"fork":false,"pushed_at":"2018-06-12T16:56:37.000Z","size":48,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-19T11:24:19.550Z","etag":null,"topics":["aws","aws-lambda","lambda","performance","pwmetrics","webperf"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chriszarate.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-11T04:36:31.000Z","updated_at":"2021-05-01T12:47:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"23facbeb-6d70-4398-bf66-c40309a2b37c","html_url":"https://github.com/chriszarate/pwmetrics-lambda","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chriszarate%2Fpwmetrics-lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chriszarate%2Fpwmetrics-lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chriszarate%2Fpwmetrics-lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chriszarate%2Fpwmetrics-lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chriszarate","download_url":"https://codeload.github.com/chriszarate/pwmetrics-lambda/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250265277,"owners_count":21402067,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","aws-lambda","lambda","performance","pwmetrics","webperf"],"created_at":"2024-10-02T05:01:52.975Z","updated_at":"2025-04-22T15:23:57.661Z","avatar_url":"https://github.com/chriszarate.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PWMetrics on AWS Lambda\n\nThis package allows you to run [PWMetrics][pwmetrics] on AWS Lambda (Node\n6.10.3), using a binary compiled specifically for that platform (from the\n[Serverless Chrome][serverless-chrome] project).\n\n## Usage\n\n```sh\nnpm install --save pwmetrics-lambda\n```\n\nThis package exports a function that wraps PWMetrics—see that package’s\n[documentation][pwmetrics] for details on parameters and options. Like\nPWMetrics, it returns a `Promise` for the results of the the test(s).\n\n## Example Lambda function\n\nThis function accepts a URL to test and PWMetrics options from the Lambda event\npayload.\n\n```js\nconst lambdaPWMetrics = require('pwmetrics-lambda');\n\nexports.handler = (event, context, callback) =\u003e {\n\tconst { options, url } = event;\n\n\tlambdaPWMetrics(url, options).then(results =\u003e {\n\t\t// Do something with results.\n\t\tcallback(null, results.runs);\n\t}).catch(callback);\n};\n```\n\n**Important considerations:**\n\n- Increase the timeout to at least 15 seconds. Adjust as needed.\n\n- Increase the allotted memory to at least 768 MB. Adjust as needed. Resource-\n  intensive pages may require considerably more memory.\n\n- Implement a `catch` method that calls the Lambda callback in case of a problem\n  with the test.\n\n- The Chrome binary is quite large (~100 MB)—too big to upload directly to\n  Lambda. You will need to sideload your function via S3. Most frameworks (e.g.,\n  Serverless, Claudia) support this either automatically or via options.\n\n## Testing locally\n\nBecause PWMetrics uses [Lighthouse][lighthouse] to launch Chrome, you can run it\nlocally and Lighthouse should find and use a local copy of Chrome.\n\n\n[pwmetrics]: https://github.com/paulirish/pwmetrics\n[serverless-chrome]: https://github.com/adieuadieu/serverless-chrome\n[lighthouse]: https://developers.google.com/web/tools/lighthouse/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchriszarate%2Fpwmetrics-lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchriszarate%2Fpwmetrics-lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchriszarate%2Fpwmetrics-lambda/lists"}