Error while using a HTTP Cloud function in GCP

+1 vote

I am getting the following error:

XMLHttpRequest cannot load https://region-project.cloudfunctions.net/function.
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://yourdomain.com' is therefore not allowed access.

How do I troubleshoot the following error?

Oct 23, 2019 in GCP by anonymous
• 19,610 points
905 views

1 answer to this question.

0 votes

If CORS isn't set up properly, you're likely to get errors that look like the above.

Cross-Origin Resource Sharing (CORS) is a way to let applications running on one domain access content from another domain, for example, letting yourdomain.com make requests to region-project.cloudfunctions.net/yourfunction.

Ensure that CORS is correctly set. This would resolve the error.
 

Hope it works!!

If you want to become a professional Google Cloud Architect, Its recommended to go for the certification course first.

Thanks!

answered Oct 23, 2019 by Sirajul
• 59,230 points

Related Questions In GCP

0 votes
1 answer
0 votes
0 answers

How to test a Cloud Function in Google Cloud Platform (GCP)?

I've been looking everywhere for the answer ...READ MORE

Nov 9, 2022 in GCP by Ashwini
• 5,430 points
263 views
0 votes
1 answer

Deciding on a Cloud load balancer in gcp.

Google Cloud Platform Load Balancing enables you ...READ MORE

answered Sep 26, 2019 in GCP by Sirajul
• 59,230 points
676 views
0 votes
1 answer

Creating a SQL Server instance using Google Compute engine.

Google Compute Engine provides public images preconfigured with ...READ MORE

answered Sep 23, 2019 in GCP by Sirajul
• 59,230 points
2,636 views
0 votes
1 answer
0 votes
1 answer

How do i install gcloud compute?

The gcloud compute command-line tool enables you to easily ...READ MORE

answered Sep 23, 2019 in GCP by Sirajul
• 59,230 points

edited Jun 16, 2023 by Khan Sarfaraz 1,036 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP