mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-19 00:18:27 +00:00
fix(cli): show the real import error when a cloud adapter is installed (#5763)
lambda reported any ERR_MODULE_NOT_FOUND as '@hyperframes/aws-lambda is not installed', and cloudrun matched its package name anywhere in the message, which also names the adapter when one of its own dependencies is missing. Both now use one helper that matches only Node's "Cannot find package '<pkg>'" and rethrow anything else.
This commit is contained in:
@@ -16,6 +16,7 @@ import { parseOutputResolutionFlag } from "../utils/parseOutputResolution.js";
|
||||
import type { Example } from "./_examples.js";
|
||||
import { c } from "../ui/colors.js";
|
||||
import { defaultCloudFps } from "../utils/compositionFps.js";
|
||||
import { isMissingPackageError, missingPackageMessage } from "../utils/missingPackage.js";
|
||||
|
||||
export const examples: Example[] = [
|
||||
["Deploy the Lambda render stack to AWS", "hyperframes lambda deploy"],
|
||||
@@ -239,13 +240,9 @@ export default defineCommand({
|
||||
try {
|
||||
await import("@hyperframes/aws-lambda/sdk");
|
||||
} catch (err) {
|
||||
if ((err as NodeJS.ErrnoException).code === "ERR_MODULE_NOT_FOUND") {
|
||||
if (isMissingPackageError(err, "@hyperframes/aws-lambda")) {
|
||||
console.error(
|
||||
`${c.error("@hyperframes/aws-lambda is not installed.")} The ${c.accent(`hyperframes lambda ${subcommand}`)} command needs it at runtime.\n` +
|
||||
`Install it alongside the CLI:\n` +
|
||||
` ${c.accent("npm install -g @hyperframes/aws-lambda")}\n` +
|
||||
`Or, for an opt-in dev setup:\n` +
|
||||
` ${c.accent("npm install @hyperframes/aws-lambda")}`,
|
||||
missingPackageMessage("@hyperframes/aws-lambda", `hyperframes lambda ${subcommand}`),
|
||||
);
|
||||
failCommand();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user