I don’t know if this is a bug or not, but I’ve tried integrating Mailjet, Postmark and WhatsApp for Business. A user submits a form, and one the form has been filled in, it takes those details and sends a WhatsApp or email to them.
None of these services seem to work, despite multiple attempts at getting it to rewrite how it has implemented it. They all seem to complain about a similar error, over and over:
Error in form submission: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
at handleSubmit (/components/valuation-form)
I can provide code if needed, but I’ve tried asking this many different ways, with multiple email APIs and it still consistently fails with an error like above.
I even provided it working code that I have running on Vercel, and it still seems to fail.
The Unexpected token '<', "<!DOCTYPE "... is not valid JSON error usually happens when an error page is returned from an API or external service call. Wrapping the call in a try/catch statement will let you detect and handle errors so they don’t break the expected workflow on your site.
Hey, thanks I’ll give it a go - just seems like there’s some strange behaviour on v0.
Things like colours appearing black when shown in the preview, then green once deployed. API calls work from my Mac, but then seem to fail once they’re running on Vercel or v0 preview.
Annoyingly I started a fresh chat and asked it to setup a Postmark form and send an email, that works… struggling to figure out why nothing seems to work in the other chat, despite giving it working code from another project!
I have encountered a similar issue, as documented here. Notably, dropdowns, tooltips, and select elements do not function in the vo.dev chat environment, although they operate correctly when deployed.
Two days ago, all my Next.js API backend requests initiated from the frontend in the v0.dev chat were appropriately routed through a CORS proxy. Currently, these requests are being made directly from the frontend, which results in failures. The same codebase works perfectly in the deployed environment because the edge functions are returning JSON responses. It appears that there has been a change in how the v0.dev chat environment handles Next.js API calls in the playground.