MCPcopy Index your code
hub / github.com/heygen-com/hyperframes / resolveChromeExecutablePath

Function resolveChromeExecutablePath

packages/aws-lambda/src/chromium.ts:92–128  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

90 */
91// fallow-ignore-next-line complexity
92export async function resolveChromeExecutablePath(): Promise<string> {
93 const source = resolveChromeSource();
94 if (source === "sparticuz") {
95 const mod = await loadSparticuzChromium();
96 const path = await mod.executablePath();
97 // Guard against the wedge described in ChromeBinaryUnavailableError.
98 // sparticuz's contract is "return the path to a usable binary" — when
99 // it returns null/undefined/"" we can't hand that to puppeteer-core
100 // (which will throw an unrelated-looking assertion). Same when the
101 // returned path doesn't exist (extraction failed but the function
102 // call returned).
103 if (!path || typeof path !== "string") {
104 throw new ChromeBinaryUnavailableError(source, null, SPARTICUZ_WEDGE_HINT);
105 }
106 if (!existsSync(path)) {
107 throw new ChromeBinaryUnavailableError(source, path, SPARTICUZ_WEDGE_HINT);
108 }
109 return path;
110 }
111 const explicit = process.env.HYPERFRAMES_LAMBDA_CHROME_PATH;
112 if (!explicit) {
113 throw new ChromeBinaryUnavailableError(
114 source,
115 null,
116 "HYPERFRAMES_LAMBDA_CHROME_SOURCE=chrome-headless-shell requires " +
117 "HYPERFRAMES_LAMBDA_CHROME_PATH to be set to the absolute path of the bundled binary.",
118 );
119 }
120 if (!existsSync(explicit)) {
121 throw new ChromeBinaryUnavailableError(
122 source,
123 explicit,
124 `HYPERFRAMES_LAMBDA_CHROME_PATH=${JSON.stringify(explicit)} does not exist on disk.`,
125 );
126 }
127 return explicit;
128}
129
130/**
131 * Resolve the Chromium launch args for the selected source. For

Callers 3

chromium.test.tsFile · 0.70
handlePlanFunction · 0.70
handleRenderChunkFunction · 0.70

Calls 3

resolveChromeSourceFunction · 0.85
loadSparticuzChromiumFunction · 0.85
executablePathMethod · 0.80

Tested by

no test coverage detected