Skip to content

Commit 95ec945

Browse files
andrei0x309davidfurlong
authored andcommitted
chore: handle InvalidJFSHeaderError in parseManifest
1 parent 214834d commit 95ec945

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

.changeset/little-berries-hang.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"frames.js": minor
3+
---
4+
5+
Handle `InvalidJFSHeaderError` in `parseManifest` for better error reporting

packages/frames.js/src/frame-parsers/farcasterV2.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
} from "@farcaster/frame-core";
66
import { z } from "zod";
77
import type { FarcasterManifest } from "../farcaster-v2/types";
8-
import { decodePayload, verify } from "../farcaster-v2/json-signature";
8+
import { decodePayload, verify, InvalidJFSHeaderError } from "../farcaster-v2/json-signature";
99
import { getMetaTag, removeInvalidDataFromObject } from "./utils";
1010
import type {
1111
ParseResultFramesV2,
@@ -331,7 +331,12 @@ async function parseManifest(
331331
reports: reporter.toObject(),
332332
};
333333
} catch (e) {
334-
if (e instanceof Error) {
334+
if(e instanceof InvalidJFSHeaderError) {
335+
reporter.error(
336+
"fc:manifest",
337+
`Failed to verify account association signature: InvalidJFSHeaderError`
338+
);
339+
} else if (e instanceof Error) {
335340
reporter.error(
336341
"fc:manifest",
337342
`Failed to parse frame manifest: ${String(e)}`

0 commit comments

Comments
 (0)