wevm / frog

Framework for Farcaster Frames 🐸
https://frog.fm
Other
414 stars 93 forks source link

bug: verifyFrame crashes for cast composer actions #464

Closed manan19 closed 1 month ago

manan19 commented 1 month ago

Describe the bug

88 |  * const data = bytesToHex(Uint8Array.from([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33]), { size: 32 })

89 |  * // '0x48656c6c6f20576f726c64210000000000000000000000000000000000000000'

90 |  */

91 | export function bytesToHex(value, opts = {}) {

92 |     let string = '';

93 |     for (let i = 0; i < value.length; i++) {

                             ^

TypeError: undefined is not an object (evaluating 'value.length')

      at bytesToHex (/app/node_modules/frog/node_modules/viem/_esm/utils/encoding/toHex.js:93:25)

      at messageToFrameData (/app/node_modules/frog/_lib/utils/verifyFrame.js:34:19)

      at /app/node_modules/frog/_lib/middlewares/neynar.js:14:27

Cast composer actions do not have a cast and so this line fails

Link to Minimal Reproducible Example

No response

Steps To Reproduce

No response

Frog Version

latest

TypeScript Version

No response

Check existing issues

Anything else?

No response

manan19 commented 1 month ago

@dalechyn would appreciate a quick patch and release on this one. Thanks!

dalechyn commented 1 month ago

that's a neat catch, thanks! I wonder why is buttonIndex passed for backwards compatibility but cast_id not, but that's a question for another day.

dalechyn commented 1 month ago

Can you please try frog@0.15.9-fix-wrong-parsing-of-frame-message-for-different-handlers.20240808T230644 and come back with a reply if it fixes your issue?