2
votes

My server went suddenly blank and i got following error message in browser console:

Uncaught TypeError: Cannot read property 'current' of undefined react-dom.production.min.js:134 at Vg...

What can be the issue? Something wrong with the react CDN server`?

My script in the html is:

<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script>

In development mode the message is (from my development enviroment):

(index):1 Access to script at 'https://unpkg.com/[email protected]/umd/react-dom.development.js' (redirected from 'https://unpkg.com/react-dom@16/umd/react-dom.development.js') from origin 'http://localhost' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. unpkg.com/[email protected]/umd/react-dom.development.js:1 Failed to load resource: net::ERR_FAILED App.js:63 Uncaught ReferenceError: ReactDOM is not defined at App.js:63

My react components are translated from jsx to js with Babel web page. Presets: es2015, stage-2

I got the main application up by dropping "crossorigin" from the script. But it works only in development mode, not in production mode.Server is up but slow. And it shows

[Violation] 'react-invokeguardedcallback' handler took 262ms react-dom.development.js:128

Headers in production mode

Request URL: https://unpkg.com/[email protected]/umd/react-dom.production.min.js
Request Method: GET
Status Code: 200 
Remote Address: 104.16.126.175:443
Referrer Policy: no-referrer-when-downgrade
access-control-allow-origin: *
cache-control: public, max-age=31536000
cf-cache-status: HIT
cf-ray: 4a4e1438e86e5af7-HEL
content-encoding: br
content-type: application/javascript; charset=utf-8
date: Wed, 06 Feb 2019 13:49:15 GMT
etag: W/"1a24b-tnTtN6dcAkNhpzBK8ZBEsa24AAw"
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
last-modified: Sat, 26 Oct 1985 08:15:00 GMT
server: cloudflare
status: 200
strict-transport-security: max-age=31536000; includeSubDomains; preload
vary: Accept-Encoding
x-cloud-trace-context: 7ef73148e43be758d63b9525cae9fe1c
x-content-type-options: nosniff
:authority: unpkg.com
:method: GET
:path: /[email protected]/umd/react-dom.production.min.js
:scheme: https
accept: */*
accept-encoding: gzip, deflate, br
accept-language: fi-FI,fi;q=0.9,en-US;q=0.8,en;q=0.7
origin: https://www.suomiverkko.online
referer: https://www.suomiverkko.online/
user-agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 OPR/57.0.3098.106
1
nothing wrong with react cdn, there is some problem in your react code. Somewhere in your code you are trying to read property current of some object, but that object is undefined. You can look at traceback of error in development mode to figure out where exactly the error happened. - Vaibhav Vishal
It has worked already 1 year now. Why this error now? - Kaj Risberg
I guess you fetch data in your react app from some api. Maybe there was some problem fetching the data, or maybe it didn't sent the data your react app was expecting. Try refreshing the page and the error keeps happening, try visiting that page in development mode to see detailed error. If you are already in development mode you should have a detailed traceback of error in your console. Copy paste that whole thing in your question. If this error was just a one time thing and now your website it working fine, you can stop worrying about it too much. - Vaibhav Vishal
Something to do header Access-Control-Allow-Origin.. (added to question). Not one time seems, server seems blank still - Kaj Risberg
Thank you very much for your help Vaibhav. - Kaj Risberg

1 Answers

2
votes

It started working when i load these files from my own server. Obviously the issue was some sort of network issue somewhere.