scarf-sh / scarf-js

Installation analytics for your npm package
https://scarf.sh
Apache License 2.0
156 stars 11 forks source link

Fail silently when API JSON response parsing failed #13

Closed thecodejack closed 4 years ago

thecodejack commented 4 years ago

I use react-table in a secure build environment. API requests from the build gets blocked. So when scarfJS tried to send same, it got blocked. I tried adding disable package.json config but didn't work. Following is the error observed

16:26:52 
16:26:52 SyntaxError: Unexpected end of JSON input
16:26:52     at JSON.parse (<anonymous>)
16:26:52     at /local/apps/test/frontend/node_modules/@scarf/scarf/report.js:65:27
16:26:52 npm ERR! code ELIFECYCLE
16:26:52 npm ERR! errno 1
16:26:52 npm ERR! @scarf/scarf@0.1.5 postinstall: `node ./report.js`
16:26:52 npm ERR! Exit status 1
16:26:52 npm ERR! 
16:26:52 npm ERR! Failed at the @scarf/scarf@0.1.5 postinstall script.
16:26:52 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
16:26:52 
aviaviavi commented 4 years ago

Hi @thecodejack, apologies for the trouble here. I'm looking into it now and will have this resolved ASAP

aviaviavi commented 4 years ago

@thecodejack the fix has been released, can you try installing again?

aviaviavi commented 4 years ago

linking https://github.com/tannerlinsley/react-table/issues/2169

thecodejack commented 4 years ago

@aviaviavi Thanks for quick fix. Will check and update soon.

BTW, will API calls still happen even when we set disabled state?

aviaviavi commented 4 years ago

Sure thing! API calls will not be fired if scarf is disabled

jainrounak6 commented 2 years ago

I'm still facing the issue. Please find the logs below:

Version : @scarf/scarf@1.0.4

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @scarf/scarf@1.0.4 postinstall: `node ./report.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @scarf/scarf@1.0.4 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-11-13T07_11_17_772Z-debug.log

Version : @scarf/scarf@1.1.1

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @scarf/scarf@1.1.1 postinstall: `node ./report.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @scarf/scarf@1.1.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-11-13T07_14_05_053Z-debug.log
aviaviavi commented 2 years ago

@jainrounak6 are you installing older versions react-table or something else that's including Scarf? Any more info you can provide about reproducing the issue would be helpful, as this is unexpected in these versions.

jainrounak6 commented 2 years ago
{
  "name": "client",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve --proxy-config proxy.conf.json",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "compile:server": "webpack --config webpack.server.config.js --progress --colors",
    "serve:ssr": "node dist/server",
    "build:ssr": "npm run build:client-and-server-bundles && npm run compile:server",
    "build:client-and-server-bundles": "ng build --prod && ng run client:server:production --bundleDependencies all"
  },
  "private": true,
  "dependencies": {
    "1.0.2": "^1.0.0",
    "@angular/animations": "~8.2.0",
    "@angular/cdk": "^8.2.3",
    "@angular/common": "~8.2.0",
    "@angular/compiler": "~8.2.0",
    "@angular/core": "~8.2.0",
    "@angular/forms": "~8.2.0",
    "@angular/material": "^8.2.3",
    "@angular/platform-browser": "^8.2.0",
    "@angular/platform-browser-dynamic": "~8.2.0",
    "@angular/platform-server": "~8.2.0",
    "@angular/pwa": "^0.1001.3",
    "@angular/router": "~8.2.0",
    "@angular/service-worker": "~8.2.0",
    "@kolkov/angular-editor": "1.0.2",
    "@ng-bootstrap/ng-bootstrap": "^5.1.2",
    "@ng-select/ng-select": "^3.7.0",
    "@nguniversal/express-engine": "^8.2.6",
    "@nguniversal/module-map-ngfactory-loader": "v8.2.6",
    "@ngx-meta/core": "^8.0.2",
    "@ngx-share/core": "^7.1.4",
    "@scarf/scarf": "^0.1.5",
    "angular-ng-autocomplete": "^1.1.14",
    "angular2-multiselect-dropdown": "^4.6.4",
    "bootstrap": "4.1.1",
    "chart.js": "2.9.3",
    "express": "^4.15.2",
    "font-awesome": "4.7.0",
    "hammerjs": "^2.0.8",
    "jquery": "^3.4.1",
    "localstorage-polyfill": "^1.0.1",
    "moment": "^2.24.0",
    "mydatepicker": "^2.6.6",
    "ng2-charts": "2.3.0",
    "ng2-completer": "3.0.3",
    "ng2-search-filter": "0.5.1",
    "ng2-smart-table": "1.5.0",
    "ng2-tooltip-directive": "2.8.17",
    "ngx-bootstrap": "^5.1.0",
    "ngx-chips": "2.0.2",
    "ngx-image-cropper": "^2.0.2",
    "ngx-infinite-scroll": "8.0.1",
    "ngx-owl-carousel": "^2.0.7",
    "ngx-spinner": "8.1.0",
    "ngx-toastr": "^10.2.0",
    "rxjs": "^6.4.0",
    "rxjs-compat": "^6.5.3",
    "rxjs-observable": "0.0.7",
    "tslib": "^1.10.0",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.802.0",
    "@angular/cli": "~8.2.0",
    "@angular/compiler-cli": "~8.2.0",
    "@angular/language-service": "~8.2.0",
    "@types/express": "^4.17.0",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "angular-ide": "^0.9.74",
    "codelyzer": "^5.0.0",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "protractor": "~5.4.0",
    "ts-loader": "^5.2.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.15.0",
    "typescript": "~3.5.3",
    "webpack-cli": "^3.1.0"
  }
}