[SOLVED] Property 'socket' -> object with constructor 'TLSSocket'

I am having same issues as this post, but I do not see anything wrong with my parameters

const config = {
    domain: 'https://localhost:3000',
    statement: 'Please sign this message to confirm your identity.',
    uri: 'https://localhost:3000',
    timeout: 60,
};

const address='0xE725..........',
chain=5,
network='evm';

await Moralis.start({ apiKey: process.env.MORALIS_API_KEY });
const message = await Moralis.Auth.requestMessage({
            address,
            chain,
            network,
            ...config,  
        });

getting error:

error - TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'ClientRequest'
    |     property 'socket' -> object with constructor 'TLSSocket'
    --- property '_httpMessage' closes the circle

try chainId here to see if there is any difference, it shouldn’t be related to the timeout error

the interface RequestMessageEvmOptions needs to update to chainId then…
but… more problems.

TypeError: Cannot read properties of undefined (reading 'toString')
    at Function.EvmChainParser.parse (path/node_modules/@moralisweb3/evm-utils/lib/dataTypes/EvmChain/EvmChainParser.js:24:34)
    at new EvmChain (path/node_modules/@moralisweb3/evm-utils/lib/dataTypes/EvmChain/EvmChain.js:17:55)
    at Function.EvmChain.create (path/node_modules/@moralisweb3/evm-utils/lib/dataTypes/EvmChain/EvmChain.js:202:16)
    at makeEvmRequestMessage (path/node_modules/@moralisweb3/auth/lib/methods/requestMessage.js:39:161)
    at path/node_modules/@moralisweb3/auth/lib/methods/requestMessage.js:48:20
    at MoralisAuth._this.requestMessage (path/node_modules/@moralisweb3/auth/lib/MoralisAuth.js:27:112)
    at handler (webpack-internal:///(api)/./pages/api/auth/request-message.ts:21:83)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.apiResolver (path/node_modules/next/dist/server/api-utils/node.js:185:9)
    at async DevServer.runApi (path/node_modules/next/dist/server/next-server.js:395:9)

what version of the sdk you are using?

im using:
“moralis”: “2.0.3”

also just uninstall 2.0 and tried 2.5, getting same issue

You could try directly in swagger interface for auth api to see if it works there
You will find it in documentation

thanks

got it.
anyone who stumbles here on their localhost, the domain is just localhost for the configuration

2 Likes