Error while using a HTTP Cloud function in GCP.

0 votes

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 in GCP by anonymous
• 6,670 points
16 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.
 

answered Oct 23 by Sirajul
• 40,990 points

Related Questions In GCP

0 votes
1 answer
0 votes
1 answer

Deciding on a Cloud load balancer in gcp.

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

answered Sep 26 in GCP by Sirajul
• 40,990 points
37 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 in GCP by Sirajul
• 40,990 points
60 views
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 in GCP by Sirajul
• 40,990 points
74 views