How to enable CORS in Cloud Functions for Firebase

0 votes

Hi Guys,

I am new to the firebase service in GCP Cloud. The problem I'm having is that I can't access the function I wrote through an AJAX request. I am getting the below error.

"No 'Access-Control-Allow-Origin'" error.
Dec 17, 2020 in GCP by akhtar
• 38,170 points
232 views

1 answer to this question.

0 votes

Hi@akhtar,

In your case, you need to set a cross-origin resource sharing mechanism in the cloud function, as shown below.

response.set('Access-Control-Allow-Origin', '*');
answered Dec 17, 2020 by MD
• 95,060 points

Related Questions In GCP

+2 votes
2 answers

How to download multiple files in Google Cloud Storage?

You can achieve this through the gsutil ...READ MORE

answered May 9, 2018 in GCP by kurt_cobain
• 9,390 points
14,180 views
0 votes
1 answer
0 votes
1 answer

How do I get to know my transaction history in Google Cloud Platform?

These are the following steps to look at the transaction history within the Google ...READ MORE

answered Oct 7, 2019 in GCP by Sirajul
• 58,990 points
268 views
0 votes
1 answer
0 votes
2 answers

Google Cloud datastore vs firebase

Google has already made a guide for ...READ MORE

answered Aug 20, 2018 in GCP by Priyaj
• 58,100 points
632 views
+2 votes
1 answer

How to create a project in GCP Cloud?

Hi@akhtar, To deploy your app on App Engine, ...READ MORE

answered Aug 22, 2020 in GCP by MD
• 95,060 points
84 views
+2 votes
1 answer

How to activate GCP Cloud Shell?

Hi@MD, You can follow the below steps to ...READ MORE

answered Aug 22, 2020 in GCP by akhtar
• 38,170 points
112 views
+2 votes
1 answer

How to enable new services to a project in GCP Cloud?

Hi@akhtar, You can enable new services to your ...READ MORE

answered Aug 22, 2020 in GCP by MD
• 95,060 points
128 views
+2 votes
1 answer

How to create a firewall rule in GCP Cloud?

Hi@akhtar, If you are using the default VPC ...READ MORE

answered Aug 22, 2020 in GCP by MD
• 95,060 points
127 views