Search code examples
expressgoogle-cloud-functionsrecaptcha

Error on Google Functions (free) trying to access reCaptcha verify


I'm new to Google Cloud Functions and reCAPTCHA. I've built my site using AngularJS and Express.js for the back-end. I've used express-recaptcha v5.0.1 for the Express.js.

I've tested the reCAPTCHA (both front-end and back-end) and it works fine when I run locally.

But when I deploy the back-end, I'm getting the following error from Google Cloud Functions:

Error: getaddrinfo EAI_AGAIN www.google.com:443
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26)

Is reCAPTCHA verify method blocked by the free plan of Google Cloud Functions?

This S/O seems to indicate that should be fine: Do I need a paid plan for using recaptcha on firebase function?

How can I debug this further?


Solution

  • After raising a support case with Firebase team, it turned out that the only way to get the API to work is to use this URL https://recaptcha.google.com/recaptcha/api/siteverify as Doug mentioned in the comment.

    So I will have to write my own module/middleware to do the verification to get it to work on the "free" Firebase tier.