[PT][BUG] Bug na requisição - evolution -> typebot error
Título: Bug na requisição - Quando user envia mensagem no whats -> typebot error
- Alguem sabe como resolver esse problema??
[Evolution API] v1.6.2 1 - Mon Mar 04 2024 18:41:37 VERBOSE [WAStartupService] [string] Getting remoteJid of instance
[Evolution API] v1.6.2 1 - Mon Mar 04 2024 18:41:37 ERROR [TypebotService] [object]
AxiosError: Request failed with status code 400
at settle (/evolution/node_modules/axios/dist/node/axios.cjs:1967:12)
at IncomingMessage.handleStreamEnd (/evolution/node_modules/axios/dist/node/axios.cjs:3066:11)
at IncomingMessage.emit (node:events:526:35)
at IncomingMessage.emit (node:domain:488:12)
at endReadableNT (node:internal/streams/readable:1376:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
at Axios.request (/evolution/node_modules/axios/dist/node/axios.cjs:3877:41)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'ERR_BAD_REQUEST',
config: {
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
},
adapter: [ 'xhr', 'http' ],
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
env: { FormData: [Function], Blob: [class Blob] },
validateStatus: [Function: validateStatus],
headers: Object [AxiosHeaders] {
Accept: 'application/json, text/plain, /',
'Content-Type': 'application/json',
'User-Agent': 'axios/1.6.7',
'Content-Length': '145',
'Accept-Encoding': 'gzip, compress, deflate, br'
},
method: 'post',
url: 'http:///api/v1/sendMessage',
data: '{"startParams":{"publicId":"themis","prefilledVariables":{"remoteJid":"@s.whatsapp.net","pushName":"Joao","instanceName":"batalha"}}}'
},
request: <ref 1> ClientRequest {
_events: [Object: null prototype] {
abort: [Function (anonymous)],
aborted: [Function (anonymous)],
connect: [Function (anonymous)],
error: [Function (anonymous)],
socket: [Function (anonymous)],
timeout: [Function (anonymous)],
finish: [Function: requestOnFinish]
},
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: true,
_last: false,
chunkedEncoding: false,
shouldKeepAlive: true,
maxRequestsOnConnectionReached: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
strictContentLength: false,
_contentLength: '145',
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
_closed: true,
socket: Socket {
connecting: false,
_hadError: false,
_parent: null,
_host: null,
_closeAfterHandlingError: false,
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 6,
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
timeout: 5000,
parser: null,
_httpMessage: null,
[Symbol(async_id_symbol)]: -1,
[Symbol(kHandle)]: [TCP],
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: Timeout {
_idleTimeout: 5000,
_idlePrev: [TimersList],
_idleNext: [Timeout],
_idleStart: 487618684,
_onTimeout: [Function: bound ],
_timerArgs: undefined,
_repeat: null,
_destroyed: false,
[Symbol(refed)]: false,
[Symbol(kHasPrimitive)]: false,
[Symbol(asyncId)]: 596613,
[Symbol(triggerId)]: 596611
},
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kSetNoDelay)]: true,
[Symbol(kSetKeepAlive)]: true,
[Symbol(kSetKeepAliveInitialDelay)]: 1,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0
},
_header: 'POST /api/v1/sendMessage HTTP/1.1\r\n' +
'Accept: application/json, text/plain, /\r\n' +
'Content-Type: application/json\r\n' +
'User-Agent: axios/1.6.7\r\n' +
'Content-Length: 145\r\n' +
'Accept-Encoding: gzip, compress, deflate, br\r\n' +
'Host: \r\n' +
'Connection: keep-alive\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: nop],
agent: Agent {
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
defaultPort: 80,
protocol: 'http:',
options: [Object: null prototype],
requests: [Object: null prototype] {},
sockets: [Object: null prototype] {},
freeSockets: [Object: null prototype],
keepAliveMsecs: 1000,
keepAlive: true,
maxSockets: Infinity,
maxFreeSockets: 256,
scheduling: 'lifo',
maxTotalSockets: Infinity,
totalSocketCount: 1,
[Symbol(kCapture)]: false
},
socketPath: undefined,
method: 'POST',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
joinDuplicateHeaders: undefined,
path: '/api/v1/sendMessage',
_ended: true,
res: IncomingMessage {
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 4,
_maxListeners: undefined,
socket: null,
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
rawHeaders: [Array],
rawTrailers: [],
joinDuplicateHeaders: undefined,
aborted: false,
upgrade: false,
url: '',
method: null,
statusCode: 400,
statusMessage: 'Bad Request',
client: [Socket],
_consuming: false,
_dumped: false,
req: [Circular 1],
responseUrl: 'http:///api/v1/sendMessage',
redirects: [],
[Symbol(kCapture)]: false,
[Symbol(kHeaders)]: [Object],
[Symbol(kHeadersCount)]: 14,
[Symbol(kTrailers)]: null,
[Symbol(kTrailersCount)]: 0
},
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: '',
protocol: 'http:',
_redirectable: Writable {
_writableState: [WritableState],
_events: [Object: null prototype],
_eventsCount: 3,
_maxListeners: undefined,
_options: [Object],
_ended: true,
_ending: true,
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 145,
_requestBodyBuffers: [],
_onNativeResponse: [Function (anonymous)],
_currentRequest: [Circular 1],
_currentUrl: 'http:///api/v1/sendMessage',
[Symbol(kCapture)]: false
},
[Symbol(kCapture)]: false,
[Symbol(kBytesWritten)]: 0,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype] {
accept: [Array],
'content-type': [Array],
'user-agent': [Array],
'content-length': [Array],
'accept-encoding': [Array],
host: [Array]
},
[Symbol(errored)]: null,
[Symbol(kHighWaterMark)]: 16384,
[Symbol(kRejectNonStandardBodyWrites)]: false,
[Symbol(kUniqueHeaders)]: null
},
response: {
status: 400,
statusText: 'Bad Request',
headers: Object [AxiosHeaders] {
'access-control-allow-origin': '',
'content-type': 'application/json',
vary: 'Accept-Encoding',
date: 'Mon, 04 Mar 2024 21:41:37 GMT',
connection: 'keep-alive',
'keep-alive': 'timeout=5',
'transfer-encoding': 'chunked'
},
config: {
transitional: [Object],
adapter: [Array],
transformRequest: [Array],
transformResponse: [Array],
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
env: [Object],
validateStatus: [Function: validateStatus],
headers: [Object [AxiosHeaders]],
method: 'post',
url: 'http:///api/v1/sendMessage',
data: '{"startParams":{"publicId":"themis","prefilledVariables":{"remoteJid":"@s.whatsapp.net","pushName":"Joao","instanceName":"batalha"}}}'
},
request: <ref *1> ClientRequest {
_events: [Object: null prototype],
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: true,
_last: false,
chunkedEncoding: false,
shouldKeepAlive: true,
maxRequestsOnConnectionReached: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
strictContentLength: false,
_contentLength: '145',
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
_closed: true,
socket: [Socket],
_header: 'POST /api/v1/sendMessage HTTP/1.1\r\n' +
'Accept: application/json, text/plain, /\r\n' +
'Content-Type: application/json\r\n' +
'User-Agent: axios/1.6.7\r\n' +
'Content-Length: 145\r\n' +
'Accept-Encoding: gzip, compress, deflate, br\r\n' +
'Host: \r\n' +
'Connection: keep-alive\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: nop],
agent: [Agent],
socketPath: undefined,
method: 'POST',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
joinDuplicateHeaders: undefined,
path: '/api/v1/sendMessage',
_ended: true,
res: [IncomingMessage],
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: '',
protocol: 'http:',
_redirectable: [Writable],
[Symbol(kCapture)]: false,
[Symbol(kBytesWritten)]: 0,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype],
[Symbol(errored)]: null,
[Symbol(kHighWaterMark)]: 16384,
[Symbol(kRejectNonStandardBodyWrites)]: false,
[Symbol(kUniqueHeaders)]: null
},
data: {
message: 'Input validation failed',
code: 'BAD_REQUEST',
data: [Object],
issues: [Array]
}
}
}
[Evolution API] v1.6.2 1 - Mon Mar 04 2024 18:41:37 ERROR [TypebotService] [object]
TypeError: Cannot read properties of undefined (reading 'messages')
at TypebotService.
@S1LV4, estou com o mesmo erro aqui.
Sua instalação do typebot é nova com ultima versão? A minha é e acabei de ver que o tybebot está com uma versão nova que saiu a 2 dias. Pode ser isso.
Vou voltar uma versão da minha instalação para ver se funciona.
@S1LV4 não era isso não.
Acho que vc precisa alterar esse arquivo aqui da EvolutionAPI: https://github.com/EvolutionAPI/evolution-api/blob/main/src/env.yml
Nesse ponto: TYPEBOT: API_VERSION: 'old' # old | latest
alterar para latest
Vou testar
Era isso mesmo. Testei aqui e deu certo!
Era isso mesmo. Testei aqui e deu certo!
Mano não sei o que aconteceu kkk, mas já tinha testado alter essa config. Subia o Docker direto com ela e nada;
Testei com a nova versão do typebot = a next e não funcionou , voltei a config para latest funcionou kkkk
@S1LV4 não era isso não.
Acho que vc precisa alterar esse arquivo aqui da EvolutionAPI: https://github.com/EvolutionAPI/evolution-api/blob/main/src/env.yml
Nesse ponto: TYPEBOT: API_VERSION: 'old' # old | latest
alterar para latest
Vou testar
Pra mim resolveu com essa solução!