Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Issue with Cloud Function

I am trying to get http response in cloud function
I have written a very simple code in cloud function to check if the email which the user has entered in correct?

 

def email_checker(request):
  email=requests.args.get()
  if "@" in email and "." in email:
    return "Valid Email"
  else:
    return "Invalid Email"
   
I am getting the below error
500 Internal Server Error: The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

Can someone please help me?
0 1 6,166
1 REPLY 1

Hi @dip1994,

Welcome to the Google Cloud Community!

You can check this Stack Overflow Post as you might have the same case.

Try changing your return statement to this format: return ("message", http_code )

def email_checker(request):

  email=requests.args.get()

  if "@" in email and "." in email:

    return ("Valid Email", 200)

  else:

    return ("Invalid Email", 400)

Let me know if it helped, thanks!