getting Error: Conflict while switching from one step to next
qadirsuh opened this issue · 0 comments
I am trying to move my bot from one step to next. but I am getting error. log is shown below.
Here is my code to switch step from one to other.
stateMachine.setState(ai_action)
.catch((err) => {
console.error('SmoochBot error: setState', err); // Here its crashing. and getting the Error Conflict with status code 409, log is given below
res.end();
});
stateMachine.receiveMessage(params)
.then(() => res.end())
.catch((err) => {
console.error('SmoochBot error: receiveMessage', err);
res.end();
});
Error log
_Jul 20 23:08:50 qjamesbot-staging app/web.1: SmoochBot error: setState { Error: Conflict
Jul 20 23:08:50 qjamesbot-staging app/web.1: at handleStatus (/app/node_modules/smooch-bot/node_modules/smooch-core/lib/utils/http.js:45:17)
Jul 20 23:08:50 qjamesbot-staging app/web.1: at process._tickCallback (internal/process/next_tick.js:109:7)
Jul 20 23:08:50 qjamesbot-staging app/web.1: response:
Jul 20 23:08:50 qjamesbot-staging app/web.1: Body {
Jul 20 23:08:50 qjamesbot-staging app/web.1: url: 'https://api.smooch.io/v1/appusers/2b08d6523c53317795409268',
Jul 20 23:08:50 qjamesbot-staging app/web.1: status: 409,
Jul 20 23:08:50 qjamesbot-staging app/web.1: statusText: 'Conflict',
Jul 20 23:08:50 qjamesbot-staging app/web.1: headers: Headers { _headers: [Object] },
Jul 20 23:08:50 qjamesbot-staging app/web.1: ok: false,
Jul 20 23:08:50 qjamesbot-staging app/web.1: body:
Jul 20 23:08:50 qjamesbot-staging app/web.1: PassThrough {
Jul 20 23:08:50 qjamesbot-staging app/web.1: _readableState: [Object],
Jul 20 23:08:50 qjamesbot-staging app/web.1: readable: true,
Jul 20 23:08:50 qjamesbot-staging app/web.1: domain: null,
Jul 20 23:08:50 qjamesbot-staging app/web.1: _events: [Object],
Jul 20 23:08:50 qjamesbot-staging app/web.1: _eventsCount: 1,
Jul 20 23:08:50 qjamesbot-staging app/web.1: _maxListeners: undefined,
Jul 20 23:08:50 qjamesbot-staging app/web.1: _writableState: [Object],
Jul 20 23:08:50 qjamesbot-staging app/web.1: writable: false,
Jul 20 23:08:50 qjamesbot-staging app/web.1: allowHalfOpen: true,
Jul 20 23:08:50 qjamesbot-staging app/web.1: _transformState: [Object] },
Jul 20 23:08:50 qjamesbot-staging app/web.1: bodyUsed: false,
Jul 20 23:08:50 qjamesbot-staging app/web.1: size: 0,
Jul 20 23:08:50 qjamesbot-staging app/web.1: timeout: 0,
Jul 20 23:08:50 qjamesbot-staging app/web.1: _raw: [],
Jul 20 23:08:50 qjamesbot-staging app/web.1: abort: false } }
When I am searching the server status code 409 it states
https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
The request could not be completed due to a conflict with the current state of the target resource. This code is used in situations where the user might be able to resolve the conflict and resubmit the request.