jos*_*132 2 javascript node.js axios
我有一些代码现在可以工作,但即使代码没有更改,目前也无法工作。不过我现在在另一台计算机上。
尽管我已经做了一些测试(console.log)并且看起来没有任何内容返回 null,但我收到有关用 null 替换值的错误。下面是代码以及错误消息。我确实检查了“config”变量,它确实有一个值。我想知道这个错误意味着什么/是什么原因造成的。我尝试过谷歌,发现了一些有关它的问题,但没有一个解决方案,只是有很多“我也是”的回应。
代码
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)
})
Run Code Online (Sandbox Code Playgroud)
错误消息/控制台输出
{
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)
Run Code Online (Sandbox Code Playgroud)