{"id":15369275,"url":"https://github.com/erezrokah/lighthouse-layer","last_synced_at":"2025-09-11T13:38:23.457Z","repository":{"id":36982592,"uuid":"198221645","full_name":"erezrokah/lighthouse-layer","owner":"erezrokah","description":"A Lambda layer with all the required dependencies to run Google Lighthouse","archived":false,"fork":false,"pushed_at":"2025-04-14T01:41:44.000Z","size":583,"stargazers_count":37,"open_issues_count":4,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T02:42:05.161Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/erezrokah.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null}},"created_at":"2019-07-22T12:44:46.000Z","updated_at":"2025-04-14T01:41:34.000Z","dependencies_parsed_at":"2023-09-25T04:55:51.801Z","dependency_job_id":"f379d6ca-9406-4f78-a0a3-2452803552db","html_url":"https://github.com/erezrokah/lighthouse-layer","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/erezrokah%2Flighthouse-layer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erezrokah%2Flighthouse-layer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erezrokah%2Flighthouse-layer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erezrokah%2Flighthouse-layer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erezrokah","download_url":"https://codeload.github.com/erezrokah/lighthouse-layer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249085474,"owners_count":21210267,"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":[],"created_at":"2024-10-01T13:34:58.178Z","updated_at":"2025-04-15T13:52:38.456Z","avatar_url":"https://github.com/erezrokah.png","language":"JavaScript","readme":"# Lighthouse Lambda Layer\n\nA Lambda layer with all the required dependencies to run Google Lighthouse.\n\n## Prerequisites\n\n[Nodejs](https://nodejs.org/en/) (at least version 10)\n\n[Yarn](https://yarnpkg.com/lang/en/)\n\nAmazon AWS account and `awscli` installed and configured: \u003chttps://aws.amazon.com/getting-started/\u003e\n\nServerless [CLI](https://serverless.com/framework/docs/getting-started/)\n\n## Setup\n\n```bash\nyarn\n```\n\n## Deploy\n\n```bash\nyarn deploy\n```\n\n### Usage\n\nIn your `serverless.yml`:\n\n```yaml\nfunctions:\n  functionThatUsesLighthouse:\n    layers:\n      - layerArn # You'll have this after you run the deploy command\n```\n\nIn you Lambda function:\n\n```ts\nconst lighthouse = require('lighthouse');\nconst log = require('lighthouse-logger');\nconst chromeLauncher = require('chrome-launcher');\n\nlet chromePath = undefined;\n\n// this lets us support invoke local\nif (!process.env.IS_LOCAL) {\n  chromePath = '/opt/bin/chromium';\n\n  // https://github.com/alixaxel/chrome-aws-lambda/blob/3779715fdc197a245af662725977133b2d676bf9/source/index.js#L6\n  // required for node10 support - makes sure fonts and shared libraries are loaded correctly\n  if (process.env.FONTCONFIG_PATH === undefined) {\n    process.env.FONTCONFIG_PATH = '/opt/lib';\n  }\n\n  if (\n    process.env.LD_LIBRARY_PATH \u0026\u0026\n    process.env.LD_LIBRARY_PATH.startsWith('/opt/lib:') !== true\n  ) {\n    process.env.LD_LIBRARY_PATH = [\n      ...new Set(['/opt/lib', ...process.env.LD_LIBRARY_PATH.split(':')]),\n    ].join(':');\n  }\n}\n\nconst chromeFlags = [\n  '--headless',\n  '--disable-dev-shm-usage',\n  '--disable-gpu',\n  '--no-zygote',\n  '--no-sandbox',\n  '--single-process',\n  '--hide-scrollbars',\n];\n\n// utility function to run lighthouse\nconst runLighthouse = async url =\u003e {\n  let chrome = null;\n  try {\n    chrome = await chromeLauncher.launch({ chromeFlags, chromePath });\n\n    const options = {\n      port: chrome.port,\n      logLevel: 'info',\n    };\n\n    log.setLevel(options.logLevel);\n\n    const results = await lighthouse(url, options);\n    return results;\n  } finally {\n    if (chrome) {\n      await chrome.kill();\n    }\n  }\n};\n\n// do something with runLighthouse\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferezrokah%2Flighthouse-layer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferezrokah%2Flighthouse-layer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferezrokah%2Flighthouse-layer/lists"}