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:
Miguel Ángel
2026-10-17 18:14:02 +00:00
committed by GitHub
parent 20611541b1
commit d0da232ec9
4 changed files with 64 additions and 17 deletions
+3 -6
View File
@@ -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();
}