Feb 28, 202411:36 AM - edited Feb 28, 202411:39 AM
Member
Hubspot forms with Next.js 13 - Unhandled Runtime Error: reCAPTCHA placeholder element must be an el
SOLVE
Im having some difficulty solving this Error in my Next.js 13 application.
Full Error:
Unhandled Runtime Error
Error: reCAPTCHA placeholder element must be an element or id
Im am using the app router and integrating the hubspot form using an embed code. I have included the Hubspot script in a next tag in the layout.tsx file and am rendering the form using the following function:
The form renders fine and seems to work okay too, hubspot is receiving data and if I inspect on both the live and the local site I can see a recaptcha token is present however on my local version I am getting this error:
Unhandled Runtime Error Error: reCAPTCHA placeholder element must be an element or id
Any help on this would be much appreciated, Ive been around the houses on this one and cant seem to find anything.
Aside from inspecting the source and console tabs in the inspector to make sure there are no errors or bad network responses I am out of ideas. The only other mention of this issue I have found has the solution of using the next-hubspot package however it would appear this is specific to previous versions of next.js and not the app router. I have tried using both the method as well as loading the script like so :
Hubspot forms with Next.js 13 - Unhandled Runtime Error: reCAPTCHA placeholder element must be an el
SOLVE
Hi Adam, I was facing this issue too. I'm now using "next-hubspot" package from npm. I return the target element once loaded is true, and it seems to be working for me now. Let me know if this also resolves the issue for you! Good luck!
Hubspot forms with Next.js 13 - Unhandled Runtime Error: reCAPTCHA placeholder element must be an el
SOLVE
Hi, @AdamBenjamin👋 Thanks for your question. I don't have direct experience with using Next.js and app-router. Let's invite a few community members to the conversation — hey @himanshurauthan@alyssamwilie@JBeatty, do you have any Next.js 13 experience you can share with @AdamBenjamin?
Thank you for taking a look! — Jaycee
HubSpot’s AI-powered customer agent resolves up to 50% of customer queries instantly, with some customers reaching up to 90% resolution rates. Learn More.
Did you know that the Community is available in other languages? Join regional conversations by changing your language settings !
Hubspot forms with Next.js 13 - Unhandled Runtime Error: reCAPTCHA placeholder element must be an el
SOLVE
Hi Jaycee, Thanks for picking this up and putting the word out. Still havent made any progress. It might appear that the issue lies with the recaptcha being an iframe within an iframe but it could also be that im grasping at any old thing at this point.
Hubspot forms with Next.js 13 - Unhandled Runtime Error: reCAPTCHA placeholder element must be an el
SOLVE
Hi Adam, I was facing this issue too. I'm now using "next-hubspot" package from npm. I return the target element once loaded is true, and it seems to be working for me now. Let me know if this also resolves the issue for you! Good luck!
Hubspot forms with Next.js 13 - Unhandled Runtime Error: reCAPTCHA placeholder element must be an el
SOLVE
Hey! I'm having the same issue, using next-hubspot also, and tried forrender the target element on "loaded", but I'm still getting the error. Does your return the JSX look something like this? <div>