Giter VIP home page Giter VIP logo

Comments (3)

stereobooster avatar stereobooster commented on May 14, 2024

This is what I get

yarn build
...
yarn build-2-TODO
...
🕸  (1/4) /
🔥  /insights/ pageerror: Error: SyntaxError: Unexpected token < in JSON at position 0
    at http://localhost:45678/static/js/0.81dd690f.chunk.js:1:3016
    at call (../static/js/0.81dd690f.chunk.js:61:22)
    at step (../static/js/0.81dd690f.chunk.js:42:52)
    at call (../static/js/0.81dd690f.chunk.js:46:96)
    at step (../static/js/0.81dd690f.chunk.js:42:52)
    at next (../static/js/0.81dd690f.chunk.js:33:57)
    at <anonymous>
...

Which comes from

return fetch(`/api/get-stat/?id=${encodeURIComponent(m)}`

There is no such endpoint in static server used by reactSnap.

PS also call stack doesn't look helpful. TODO: report bug to create-react-app-typescript

UPD more precise error position based on SourceMaps at json pages/InsightsPage.tsx:58:32

from react-snap.

jonathaningram avatar jonathaningram commented on May 14, 2024

@stereobooster thanks for your help. Interestingly I still cannot reproduce getting a stack trace out of this myself. Maybe it's my version of node compared to yours:

$ npm --version
5.5.1
$ node --version
v9.0.0

Either way, I appreciate your help and I'll look into it from my end to figure out how to make sure that the app doesn't crash when trying to crawl when that API call is being made.

Edit: also instead of throwing errors when the fetch call fails, I just changed it to console.error for now and that fixes the exit status 1 code.

from react-snap.

stereobooster avatar stereobooster commented on May 14, 2024

I still cannot reproduce getting a stack trace out of this myself

yes this is mystery. My versions

node -v
v8.6.0
npm -v
5.3.0
yarn -v
1.2.1

You can detect reactSnap like this const snap = navigator.userAgent !== 'ReactSnap';. And use something else instead of actual content, for example react-content-loader

from react-snap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.