Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Framegear: Getting Unexpected end of JSON input error with a button target and when there is no frame postUrl #380

Open
nolanjannotta opened this issue May 22, 2024 · 1 comment

Comments

@nolanjannotta
Copy link

nolanjannotta commented May 22, 2024

Describe the bug and the steps to reproduce it

when a button has a target property AND when the frame does not have a postUrl property, Framegear will throw a Uncaught (in promise) SyntaxError: Unexpected end of JSON input error in the browser console. In the server console you get TypeError: Cannot read properties of undefined (reading 'toString') and POST /api/postFrame 500

to reproduce:

  1. clone a frame in 100 lines
  2. in app/page.tsx delete the postUrl: `${NEXT_PUBLIC_URL}/api/frame`, and add a target to the first button like this: { label: 'Story time', target: `${NEXT_PUBLIC_URL}/api/frame`, },
  3. run framegear and the frame server, paste url in framegear, press the button
  4. you should see the same errors

I believe it has something to do framegear/app/api/postFrame/route.ts. If I hardcode the url in this line: const postUrl = frameData.url; so like this: const postUrl = "http://localhost:3000/api/frame" there is no error. So frameData.url is undefined. In a previous version of framegear that I cloned months ago (I'm not sure which version) I did not have this issue. I updated everything the other day and I started getting this error.

Note: if you delete the const { isValid, message } = await getFrameMessage() line and everything that uses isValid and message the frame will work in the frames.js debugger with the button target. So it seems like a framegear issue.

What's the expected behavior?

Framegear should not throw an error and a button click with a target should work.

What version of the libraries are you using?

onchainkit - 0.14.1
most recent framegear

@dudany
Copy link

dudany commented Jul 27, 2024

I encountered the same issue with framegear

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants
@nolanjannotta @dudany and others