react-google-autocomplete icon indicating copy to clipboard operation
react-google-autocomplete copied to clipboard

google is not defined at refreshSessionToken

Open sayad-mallllek opened this issue 3 years ago • 3 comments

I am using react autocomplete with session tokens and I had to use a useeffect on the main page load to add a session token because by default is comes null from usePlacesService

useEffect(() => { refreshSessionToken(); return () => {}; }, []);

I am using Nextjs and it is giving this error framework-79bce4a3a540b080.js:1 ReferenceError: google is not defined at refreshSessionToken (8345-36847ac2dcf11485.js:1:16048) at 6436-17e866bb9800252e.js:1:14460 at Ui (framework-79bce4a3a540b080.js:1:104667) at t.unstable_runWithPriority (framework-79bce4a3a540b080.js:1:129355) at Ql (framework-79bce4a3a540b080.js:1:44986) at Fi (framework-79bce4a3a540b080.js:1:104128) at bi (framework-79bce4a3a540b080.js:1:95618) at framework-79bce4a3a540b080.js:1:45209 at t.unstable_runWithPriority (framework-79bce4a3a540b080.js:1:129355) at Ql (framework-79bce4a3a540b080.js:1:44986)

And it causes a client side exception

sayad-mallllek avatar Jul 06 '22 12:07 sayad-mallllek

Will check it asap

ErrorPro avatar Aug 18 '22 10:08 ErrorPro

I got the same error. I wasn't providing the apiKey that's why this error occurred. You should check if you're providing apiKey or not.

pymanish avatar Jul 22 '23 13:07 pymanish