open-frames/proxy

TypeError: Failed to fetch

Closed this issue · 3 comments

Hey,

I'm running into this error while rendering some buttons from popular Frames.

Examples:
Frame: https://fc-polls.vercel.app/polls/87b1ed3f-5f86-479a-acc7-727943eecfe3
Repo: https://github.com/farcasterxyz/fc-polls or https://github.com/xmtp-labs/fc-polls
Button: Create your poll

Frame:
Repo: https://github.com/fabriguespe/a-frame-in-100-lines-main
Frame: https://a-frame-in-100-lines-main.vercel.app/
Buttons: All

Live domain
CleanShot 2024-03-17 at 15 26 19@2x

Localhost:
CleanShot 2024-03-15 at 18 17 05@2x

Environment:

Some ways to solve this

  • run proxy on the same origin
  • configure the CORS rules to allow this request - not sure exactly which rule where would solve this though, would have to look at it more closely

I believe what's happening here is that we are only setting CORS headers on success but not on error. That causes the true source of these errors to be hidden (which is that we are sending POST requests that the servers don't understand and the remote server is returning an error status code)

@fabriguespe Agreeing with @neekolas here there is an error happening so the CORS headers aren't getting set. If we bypass the proxy it will also error, this is because a few of these frames don't support Open Frames POSTs
https://github.com/fabriguespe/a-frame-in-100-lines/blob/main/app/api/frame/route.ts#L9