question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Setting ORIGIN leads to wrong request url.

See original GitHub issue

I have a firebase function called helloworld. Everything is working fine. Now I want to set the ORIGIN for the functions calls to prevent the double request for ‘OPTIONS’. As described in the docs I added following in the app module:

  providers: [
    { provide: ORIGIN, useValue: 'https://example-main.web.app' },
  ]

Expected behavior

Setting the ORIGIN should lead to function requests like: http://example-main.web.app/helloworld

Actual behavior

Setting the ORIGIN should leads to function requests like: http://example-main.web.app/example-main/us-central1/helloworld

Version info

  "dependencies": {
    "@angular-material-extensions/pages": "^4.0.0",
    "@angular-material-extensions/password-strength": "^6.0.0",
    "@angular/animations": "^9.1.12",
    "@angular/cdk": "^9.2.4",
    "@angular/common": "^9.1.12",
    "@angular/compiler": "^9.1.12",
    "@angular/core": "^9.1.12",
    "@angular/fire": "^6.0.3",
    "@angular/flex-layout": "^9.0.0-beta.31",
    "@angular/forms": "^9.1.12",
    "@angular/material": "^9.2.4",
    "@angular/platform-browser": "^9.1.12",
    "@angular/platform-browser-dynamic": "^9.1.12",
    "@angular/platform-server": "^9.1.12",
    "@angular/pwa": "^0.1001.3",
    "@angular/router": "^9.1.12",
    "@angular/service-worker": "~10.1.3",
    "@nguniversal/express-engine": "^9.1.1",
    "@nguniversal/module-map-ngfactory-loader": "^8.2.6",
    "@ngx-translate/core": "^12.1.1",
    "@ngx-translate/http-loader": "^4.0.0",
    "@swimlane/ngx-charts": "^14.0.0",
    "angulartics2": "^8.3.0",
    "bufferutil": "^4.0.1",
    "express": "^4.15.2",
    "firebase": "^7.19.1",
    "ngx-auth-firebaseui": "^4.4.0",
    "ngx-clipboard": "^12.3.1",
    "ngx-markdown": "^9.1.1",
    "rxjs": "~6.5.5",
    "tslib": "^1.13.0",
    "utf-8-validate": "^5.0.2",
    "ws": "^7.3.1",
    "xhr2": "^0.2.0",
    "zone.js": "~0.10.3"
  }

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jamesdanielscommented, Oct 19, 2020

Right now we only support that option. Just add the extra URL pieces (example-main/us-central1) to your Cloud Functions passthrough in firebase.json

0reactions
jamesdanielscommented, Nov 13, 2020

6.1.0-rc.2 now has a NEW_ORIGIN_BEHAVIOR DI token that allows you to opt into the new way of setting origin in v8.

{ provide: NEW_ORIGIN_BEHAVIOR, useValue: true }

Read more comments on GitHub >

github_iconTop Results From Across the Web

CORS errors and how to solve them - Topcoder
Still facing a CORS error? ... Open a network tab in your console. ... In the response header look for the Access-Control-Allow-Origin header....
Read more >
CORS errors - HTTP - MDN Web Docs - Mozilla
If the CORS configuration isn't setup correctly, the browser console will present an error like "Cross-Origin Request Blocked: The Same ...
Read more >
Access Control Origin Header error using Axios - Stack Overflow
I'll have a go at this complicated subject. What is origin? The origin itself is the name of a host (scheme, hostname, and...
Read more >
Controlling origin requests - Amazon CloudFront
Use origin request policies to control the contents of the requests that Amazon CloudFront sends to your origin.
Read more >
ERROR : No "Access-Control-Allow-Origin" header is ... - GitHub
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. Although, I set ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found