opendecide / ngx-segment-analytics

Segment Analytics for Angular 12 -> 17
MIT License
20 stars 9 forks source link

Unexpected token issue when serving v18.0.1 #193

Open mybugatti opened 4 months ago

mybugatti commented 4 months ago

Bug Report or Feature Request (mark with an x)

- [ x] bug report -> please search issues before submitting
- [ ] feature request

OS and Version?

OS: macOS 14.5

Generator Version

v18.0.1

Tools Version

Node: 20.12.2 
npm: 10.5.0

Targeted Angular version

"@angular/common": "^18.1.0",
"@angular/compiler": "^18.1.0",
"@angular/core": "^18.1.0",

Repro steps.

https://github.com/mybugatti/ngx-segment

  1. Execute https://stackblitz.com/~/github.com/mybugatti/ngx-segment
  2. Open the console and this will show unexpected token error.

The log given by the failure.

Unexpected token '<', "<!DOCTYPE "... is not valid JSON SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON

Desired functionality.

No error

Mention any other details that might be useful.

ankitpandeypagefreezer commented 1 month ago

@mybugatti I am facing same kind of issue, can you please see the network tab and paste the URL.

After upgrading to V18: When loadOnInitialization: true SegmentModule.forRoot({ apiKey: environment.KEY, debug: false, loadOnInitialization: true }),

WRONG API call happening: http://localhost:7001/cdn.segment.com/v1/projects/KEY/settings

API call should be: https://cdn.segment.com/v1/projects/KEY/settings

Issue:

image