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,260 points
2,842 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', '*');


Hope it helps!!

If you need to know more about Google Cloud, We recommend joining GCP Certification course today.

Thanks!

answered Dec 17, 2020 by MD
• 95,460 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,350 points
23,538 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,230 points
2,033 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,020 points
1,816 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 23, 2020 in GCP by MD
• 95,460 points
721 views
+2 votes
1 answer

How to activate GCP Cloud Shell?

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

answered Aug 23, 2020 in GCP by akhtar
• 38,260 points
2,485 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 23, 2020 in GCP by MD
• 95,460 points
1,073 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 23, 2020 in GCP by MD
• 95,460 points
1,617 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