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,210 points
857 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,300 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
16,919 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,070 points
382 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,140 points
738 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,300 points
152 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,210 points
225 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,300 points
233 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,300 points
221 views