I have some code that was working now it currently isn't even though the code hasn't changed. I am on a different computer now though.
I am getting an error about replacing a value with null though I have done some testing (console.log) and looks like nothing is coming back null. Below is the code as well as the error message. I did check the 'config' variable and it does have a value. I am wondering what this error means/what is causing it. I have tried google and found a few issues about it however none have a solution in them just a lot of "me too" responses.
Code
console.log(message)
axios.post(config.EXPRESS_URL, {
content: message.content,
abut_code: message.abut_code,
media_url: '',
userID: message.userID,
name: message.name
}, {headers})
.then(() => {
console.log('Message sent')
})
.catch(err => {
console.log(err)
})
Error message/console output
{
content: 'test',
abut_code: 'bff1377f:d7de22eb',
userID: 'auth0|613a9e709518390070831c29',
name: 'Me 2'
}
TypeError: Cannot read property 'replace' of null
at dispatchHttpRequest (/Users/me/projects/tenanttalk/backend/websocket/node_modules/axios/lib/adapters/http.js:109:74)
at new Promise (<anonymous>)
at httpAdapter (/Users/me/projects/tenanttalk/backend/websocket/node_modules/axios/lib/adapters/http.js:46:10)
at dispatchRequest (/Users/me/projects/tenanttalk/backend/websocket/node_modules/axios/lib/core/dispatchRequest.js:52:10)
I had the same error when the provided url was not correct (I forgot the "http://" in the url in my case) check config.EXPRESS_URL and make sure it's a valid url.