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
585 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,180 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
15,387 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
• 59,050 points
310 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,120 points
681 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,180 points
111 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
157 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,180 points
179 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,180 points
174 views