[SOLVED] MetaMask Auth : [Moralis SDK Core Error]: [C0006] Request failed with status undefined: timeout of 10000ms exceeded

Nice to meet you.


I am using this page as a reference to create a login function with MetaMask.
It was working fine until a few hours ago, but then an error occurred and I could not log in.

export default async function handler(req, res) {

    console.log("req.body", req.body);
    const { address, chain, network } = req.body;

    await Moralis.start({ apiKey: process.env.MORALIS_API_KEY });
    console.log("request-message.js -->", 1);
    try {
        console.log("request-message.js -->", 2);
        console.log("request-message.js -->", config);
        const message = await Moralis.Auth.requestMessage({
            address,
            chain,
            network,
            ...config,
        });
        console.log("request-message.js -->", 3);

        res.status(200).json(message);
        console.log("request-message.js -->", 4);
    } catch (error) {
        console.log("request-message.js -->", 5);
        console.log("request-message.js -->", error);
        res.status(400).json({ error });
        console.log("request-message.js -->", 6);
        console.error(error);
    }
}

Error Description

 MoralisError [Moralis SDK Core Error]: [C0006] Request failed with status undefined: timeout of 10000ms exceeded
    at RequestController.makeError (/Users/home/git/mkdao/node_modules/@moralisweb3/core/lib/controllers/RequestController.js:137:20)
    at RequestController.<anonymous> (/Users/home/git/mkdao/node_modules/@moralisweb3/core/lib/controllers/RequestController.js:118:38)
    at step (/Users/home/git/mkdao/node_modules/@moralisweb3/core/lib/controllers/RequestController.js:44:23)
    at Object.throw (/Users/home/git/mkdao/node_modules/@moralisweb3/core/lib/controllers/RequestController.js:25:53)
    at rejected (/Users/home/git/mkdao/node_modules/@moralisweb3/core/lib/controllers/RequestController.js:17:65)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {

What line of code gives that error?

I’m getting the exact same thing on previously working code, im guessing something on moralis side is broken even though status page says otherwise

I could check in 1-2 hours when I get back to computer

What is the exact line that gives that error?

Thanks for you reply.

import Moralis from 'moralis';

const config = {
    domain: process.env.APP_DOMAIN,
    statement: 'Please sign this message to confirm your identity.',
    uri: process.env.NEXTAUTH_URL,
    timeout: 60,
};

export default async function handler(req, res) {

    const { address, chain, network } = req.body;

    await Moralis.start({ apiKey: process.env.MORALIS_API_KEY });
    try {
        // This line cause Error : AxiosError: timeout of 10000ms exceeded
        const message = await Moralis.Auth.requestMessage({
            address,
            chain,
            network,
            ...config,
        });

        res.status(200).json(message);
    } catch (error) {
        res.status(400).json({ error });
        console.error(error);
    }
}
1 Like

It looks like an issue on our side. We will investigate.

@MKDAO, @saadlazer, it should be fixed now. Can you check?

Thank you! It worked fine!

1 Like

Hi,

const message = await Moralis.Auth.requestMessage(・・・・)

The error seems to be occurring in the same place again.
Please check it out.

error - TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'ClientRequest'
    |     property 'socket' -> object with constructor 'TLSSocket'
    --- property '_httpMessage' closes the circle
    at JSON.stringify (<anonymous>)
    at sendJson (/Users/home/git/xxxxx/node_modules/next/dist/server/api-utils/node.js:321:19)
    at apiRes.json (/Users/home/git/xxxxx/node_modules/next/dist/server/api-utils/node.js:168:31)
    at handler (webpack-internal:///(api)/./pages/api/auth/request-message.js:39:25)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.apiResolver (/Users/home/git/xxxxx/node_modules/next/dist/server/api-utils/node.js:184:9)
    at async DevServer.runApi (/Users/home/git/xxxxx/node_modules/next/dist/server/next-server.js:403:9)
    at async Object.fn (/Users/home/git/xxxxx/node_modules/next/dist/server/base-server.js:493:37)
    at async Router.execute (/Users/home/git/xxxxx/node_modules/next/dist/server/router.js:222:36)
    at async DevServer.run (/Users/home/git/xxxxx/node_modules/next/dist/server/base-server.js:612:29) {
  page: '/api/auth/request-message'
1 Like

Can you post your code now and what userData looks like (using console.log).

Converting circular structure to JSON

This error can happen if you pass an invalid data object e.g. to /api/auth/request-message.

Thank you for your reply.

This is json content

{
  error: MoralisError [Moralis SDK Core Error]: [C0006] Request failed with status 400: Request failed with status code 400
      at RequestController.makeError (/Users/home/git/mkdao2/node_modules/@moralisweb3/core/lib/controllers/RequestController.js:137:20)
      at RequestController.<anonymous> (/Users/home/git/mkdao2/node_modules/@moralisweb3/core/lib/controllers/RequestController.js:118:38)
      at step (/Users/home/git/mkdao2/node_modules/@moralisweb3/core/lib/controllers/RequestController.js:44:23)
      at Object.throw (/Users/home/git/mkdao2/node_modules/@moralisweb3/core/lib/controllers/RequestController.js:25:53)
      at rejected (/Users/home/git/mkdao2/node_modules/@moralisweb3/core/lib/controllers/RequestController.js:17:65)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
    isMoralisError: true,
    code: 'C0006',
    details: { status: 400, request: [ClientRequest], response: [Object] },
    [cause]: [AxiosError: Request failed with status code 400] {
      code: 'ERR_BAD_REQUEST',
      config: [Object],
      request: [ClientRequest],
      response: [Object]
    }
  }
}

What is the data that was sent as parameters?

This is my request.

Oh! This was my miss… So sorry, I changed network, I could auth.

which network did you use?

@cryptokid I am getting the same error. BTW, the code that I have is stable and never did any changes on it recently

Moralis SDK Core Error: [C0006] Request failed: timeout of 10000ms exceeded
    at RequestController.makeError (/Users/venkateshrajendran/Documents/Work/OP Games/oparcade-backend/node_modules/@moralisweb3/core/src/controllers/RequestController/RequestController.ts:84:12)
    at RequestController.<anonymous> (/Users/venkateshrajendran/Documents/Work/OP Games/oparcade-backend/node_modules/@moralisweb3/core/src/controllers/RequestController/RequestController.ts:52:26)
    at step (/Users/venkateshrajendran/Documents/Work/OP Games/oparcade-backend/node_modules/@moralisweb3/core/lib/controllers/RequestController/RequestController.js:44:23)
    at Object.throw (/Users/venkateshrajendran/Documents/Work/OP Games/oparcade-backend/node_modules/@moralisweb3/core/lib/controllers/RequestController/RequestController.js:25:53)
    at rejected (/Users/venkateshrajendran/Documents/Work/OP Games/oparcade-backend/node_modules/@moralisweb3/core/lib/controllers/RequestController/RequestController.js:17:65)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Do I need to open a new topic / can we discuss here ?

Hey @Venkatesh_OP,

please open a new thread for your inquiry :grinning_face_with_smiling_eyes:

this one is old and solved so going to closed it for now~