question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"TypeError: Cannot convert undefined or null to object" at Socket.IO testing

See original GitHub issue

The following error occurred in the case of Socket.IO testing with response timeout. Summary report could not be displayed.

/Users/hiroaki-hotta/.config/yarn/global/node_modules/artillery/lib/console-reporter.js:167
    const coreRates = Object.keys(report.rates).filter(name => name.startsWith('core.'));
                             ^

TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at ConsoleReporter.printReport (/Users/hiroaki-hotta/.config/yarn/global/node_modules/artillery/lib/console-reporter.js:167:30)
    at ConsoleReporter.stats (/Users/hiroaki-hotta/.config/yarn/global/node_modules/artillery/lib/console-reporter.js:91:8)
    at EventEmitter.emit (/Users/hiroaki-hotta/.config/yarn/global/node_modules/eventemitter3/index.js:202:33)
    at EventEmitter.<anonymous> (/Users/hiroaki-hotta/.config/yarn/global/node_modules/artillery/lib/runner-sp.js:62:19)
    at EventEmitter.emit (/Users/hiroaki-hotta/.config/yarn/global/node_modules/eventemitter3/index.js:202:33)
    at SSMS.<anonymous> (/Users/hiroaki-hotta/.config/yarn/global/node_modules/artillery/core/lib/runner.js:332:8)
    at SSMS.emit (events.js:314:20)
    at SSMS._maybeEmitMostRecentPeriod (/Users/hiroaki-hotta/.config/yarn/global/node_modules/artillery/core/lib/ssms.js:480:12)
    at SSMS.aggregate (/Users/hiroaki-hotta/.config/yarn/global/node_modules/artillery/core/lib/ssms.js:474:10)

OS: macOS Catalina 10.15.7 Version: artillery/2.0.0-dev2 darwin-x64 node-v12.21.0 (globally installed)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dav1appcommented, May 18, 2021

I’m using the 2.0.0-dev2 version. I’m using the WebSockets implementation, not the Socket.IO.

This doesn’t break:

{
    "config": {
        "target": "ws://localhost:4001/",
        "phases": [
            {
                "duration": 20,
                "arrivalRate": 1,
            }
        ],
        "ws": {
            "subprotocols": [
                "json",
                "soap"
            ]
        }
    },
    "scenarios": [
        {
            "name": "Echo a string",
            "engine": "ws",
            "flow": [
                {
                    "send": "hello"
                },
                {
                    "think": 20
                },
                {
                    "send": "how are you?"
                }
            ]
        }
    ]
}

But add "maxVusers": 1 to phases, it breaks.

{
    "config": {
        "target": "ws://localhost:4001/",
        "phases": [
            {
                "duration": 20,
                "arrivalRate": 1,
                "maxVusers": 1
            }
        ],
        "ws": {
            "subprotocols": [
                "json",
                "soap"
            ]
        }
    },
    "scenarios": [
        {
            "name": "Echo a string",
            "engine": "ws",
            "flow": [
                {
                    "send": "hello"
                },
                {
                    "think": 20
                },
                {
                    "send": "how are you?"
                }
            ]
        }
    ]
}
0reactions
hassycommented, Apr 16, 2021

Thanks again @h6ak! This has been fixed now (on master branch).

Note that current Socket.io engine uses v2 of the Socket.io protocol so it will not work properly with newer servers unless allowEIO3 option is set on the server: https://socket.io/blog/socket-io-3-1-0/

(Just created #992 to track the upgrade on Artillery’s side)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot convert undefined or null to object - Stack Overflow
Generic answer. This error is caused when you call a function that expects an Object as its argument, but pass undefined or null...
Read more >
Cannot convert undefined or null to object" at Socket.IO testing
The following error occurred in the case of Socket.IO testing with response timeout. Summary report could not be displayed.
Read more >
npm err! cannot convert undefined or null to object - You.com
All it is saying is that it expects an object of some type but it has null as the object may be set...
Read more >
cypress-io/cypress - Gitter
We invoked the function expoerted by $file_location/cypress/plugins/index.js but it threw an error. TypeError: Cannot convert undefined or null to object.
Read more >
[Solved]-TypeError: Cannot convert undefined or null to object
You are trying to use Object method on an Array that throws an error Cannot convert undefined or null to object . You...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found