@cryptokid @johnversus I will give some more context on how I discovered the problem with this endpoint.
Like I mentioned before, the authentication using Moralis servers was working well. This week I lost the access to the moralis servers after deleting my last Moralis server, so I decided to use the self hosted solution. I followed this https://www.youtube.com/watch?v=l2qTyc-V9cM tutorial.
In the client side I am using the react Moralis v1. With the self hosted server the authentication is not working. I added a console.log to print the exception thrown in the parser server, and it was how I discovered that this endpoint was not working as expected. The exception is thrown when the server does the request to this endpoint. I did not adapt or modify any part of the parser server application, other than adding the console.log. The exception that I get, is identical to the one I get when I try directly on the page with the documentation
Earlier I reported only the problem with the endpoint to simplify the problem and be easier to explain.
I added the console.log in the catch inside the function named validateAuthData from the file MoralisEthAdapter.ts.
The exception is the following:
MoralisError [Moralis SDK Core Error]: [C0006] Request failed, Bad Request(400): Invalid message: {"success":false,"state":103,"length":17,"matched":0,"maxMatched":3,"maxTreeDepth":15,"nodeHits":134,"inputLength":17,"subBegin":0,"subEnd":17,"subLength":17}
at RequestController.makeError (/home/rute/Documents/projects/parse-server-migration/node_modules/@moralisweb3/core/lib/controllers/RequestController/RequestController.js:119:20)
at RequestController.<anonymous> (/home/rute/Documents/projects/parse-server-migration/node_modules/@moralisweb3/core/lib/controllers/RequestController/RequestController.js:100:38)
at step (/home/rute/Documents/projects/parse-server-migration/node_modules/@moralisweb3/core/lib/controllers/RequestController/RequestController.js:44:23)
at Object.throw (/home/rute/Documents/projects/parse-server-migration/node_modules/@moralisweb3/core/lib/controllers/RequestController/RequestController.js:25:53)
at rejected (/home/rute/Documents/projects/parse-server-migration/node_modules/@moralisweb3/core/lib/controllers/RequestController/RequestController.js:17:65)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:94:5) {
isMoralisError: true,
code: 'C0006',
details: {
status: 400,
response: {
status: 400,
statusText: 'Bad Request',
headers: [Object],
config: [Object],
request: [ClientRequest],
data: [Object]
}
},
cause: [AxiosError: Request failed with status code 400] {
code: 'ERR_BAD_REQUEST',
config: {
transitional: [Object],
adapter: [Function: httpAdapter],
transformRequest: [Array],
transformResponse: [Array],
timeout: 10000,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
env: [Object],
validateStatus: [Function: validateStatus],
headers: [Object],
url: 'https://authapi.moralis.io/challenge/verify/evm',
params: {},
method: 'post',
data: '{"message":"Log in to Moralis","signature":"0x81c2eca657bb56c9941ad4ca8e3f7110adf17dc3bb4ed50c40ca08502a0f772e7fd83c8d8a0dbe30c8549cdf3caed3e6aaa37df92dc3553709e7d3ed1e43cff51c"}'
},
request: ClientRequest {
_events: [Object: null prototype],
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
_closed: false,
socket: [TLSSocket],
_header: 'POST /challenge/verify/evm HTTP/1.1\r\n' +
'Accept: application/json, text/plain, */*\r\n' +
'Content-Type: application/json\r\n' +
'x-moralis-platform: JS SDK\r\n' +
'x-moralis-platform-version: 2.7.0\r\n' +
'x-moralis-build-target: node\r\n' +
'x-api-key: pNVkG0FQEbmqdi4KQzXXXXXXXgOjx6n\r\n' +
'User-Agent: axios/0.27.2\r\n' +
'Content-Length: 178\r\n' +
'Host: authapi.moralis.io\r\n' +
'Connection: close\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: {},
agent: [Agent],
socketPath: undefined,
method: 'POST',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: '/challenge/verify/evm',
_ended: true,
res: [IncomingMessage],
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: 'authapi.moralis.io',
protocol: 'https:',
_redirectable: [Writable],
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype]
},
response: {
status: 400,
statusText: 'Bad Request',
headers: [Object],
config: [Object],
request: [ClientRequest],
data: [Object]
}
}
}
authdata: {
id: '0x229b4dbbac15f306651c55aa61305612a4fc789b',
signature: '0x81c2eca657bb56c9941ad4ca8e3f7110adf17dc3bb4ed50c40ca08502a0f772e7fd83c8d8a0dbe30c8549cdf3caed3e6aaa37df92dc3553709e7d3ed1e43cff51c',
data: 'Log in to Moralis'
}
error: Moralis auth failed, invalid data {"code":101,"stack":"Error: Moralis auth failed, invalid data\n at /home/rute/Documents/projects/parse-server-migration/build/auth/MoralisEthAdapter.js:36:15\n at runMicrotasks (<anonymous>)\n at processTicksAndRejections (node:internal/process/task_queues:94:5)\n at async Promise.all (index 0)"}