expo + react-native: There was a problem sending log messages

user1790300 picture user1790300 · Feb 4, 2019 · Viewed 9.5k times · Source

I am building a react-native app that I recently moved to expo. The app seems to display the expected screen, but before it completes, I am receiving the following error message: console.error: "There was a problem sending log messages to your development environment, {"name": "Error"}". When I view the expo browser screen I see the following stack trace when I click on the device:

  node_modules/expo/build/logs/LogSerialization.js:146:14 in _captureConsoleStackTrace
  node_modules/expo/build/logs/LogSerialization.js:41:24 in Object.serializeLogDataAsync$
  node_modules/regenerator-runtime/runtime.js:62:39 in tryCatch
  node_modules/regenerator-runtime/runtime.js:288:21 in Generator.invoke [as _invoke]
  node_modules/regenerator-runtime/runtime.js:114:20 in Generator.prototype.(anonymous
  node_modules/regenerator-runtime/runtime.js:62:39 in tryCatch
  node_modules/regenerator-runtime/runtime.js:152:19 in invoke
  node_modules/regenerator-runtime/runtime.js:187:10 in <unknown>
  node_modules/promise/setimmediate/core.js:45:4 in tryCallTwo
  node_modules/promise/setimmediate/core.js:200:12 in doResolve

Here is a screenshot of the error:

enter image description here

What does this error mean? I found some doc referring to removing console.log statements and removed the ones I had but that did not help.

Answer

D.K picture D.K · Mar 11, 2019

This is due to the fact that the React native console logger CANNOT parse the JSON object coming from Axios. I can guarantee that anyone who is having this error is not PARSING the JSON object before logging it to the console.

CODE THAT WILL GIVE THIS ERROR:

Axios.post(URL).then(function (response)
{
console.log("POST RESPONSE: "+response);
}

CODE THAT FIXES THIS ERROR:

Axios.post(URL).then(function (response)
{
console.log("POST RESPONSE: "+JSON.stringify(response));
}