Skip to content

microtime error with the latest version of @reportportal/agent-js-cypress causing test to be unrunnable. #217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
chelseablake4 opened this issue Oct 1, 2024 · 6 comments
Labels

Comments

@chelseablake4
Copy link

chelseablake4 commented Oct 1, 2024

Looking for some help, I have verified two people on my team with M3 macbooks cannot run cypress with reportportal locally with the newest version of @reportportal/agent-js-cypressdue to the error below, The latest version of @reportportal/agent-js-cypress pulls in @reportportal/client-javascript version 5.3.0 which adds microtime.
v5.2.0...v5.3.0#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R33
Error loading the reporter: @reportportal/agent-js-cypress

We searched for the reporter in these paths:

-/@reportportal/agent-js-cypress

  • /node_modules/@reportportal/agent-js-cypress

Learn more at https://on.cypress.io/reporters

Error: dlopen(/node_modules/microtime/prebuilds/darwin-x64+arm64/electron.napi.node, 0x0001): tried: 'node_modules/microtime/prebuilds/darwin-x64+arm64/electron.napi.node' (code signature in <0597889B-E5ED-385D-B003-3B76F9B3F07C> '/node_modules/microtime/prebuilds/darwin-x64+arm64/electron.napi.node' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs), '/System/Volumes/Preboot/Cryptexes/OS/Users/cblake/Documents/GitHub/campaigns-web/node_modules/microtime/prebuilds/darwin-x64+arm64/electron.napi.node' (no such file), '/node_modules/microtime/prebuilds/darwin-x64+arm64/electron.napi.node' (code signature in <0597889B-E5ED-385D-B003-3B76F9B3F07C> '/node_modules/microtime/prebuilds/darwin-x64+arm64/electron.napi.node' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs)
    at process.func [as dlopen] (node:electron/js2c/node_init:2:2107)
    at Object.<anonymous> (node:internal/modules/cjs/loader:1356:18)
    at Object.func [as .node] (node:electron/js2c/node_init:2:2107)
    at Module.load (node:internal/modules/cjs/loader:1126:32)
    at node:internal/modules/cjs/loader:967:12
    at PackherdModuleLoader.origLoad (node:electron/js2c/node_init:2:13357)
    at PackherdModuleLoader.tryLoad (evalmachine.<anonymous>:1:755466)
    at Function.<anonymous> (evalmachine.<anonymous>:1:765680)
    at i._load (<embedded>:2939:67438)
    at Module.require (node:internal/modules/cjs/loader:1150:19)
    at require (node:internal/modules/cjs/helpers:121:18)
    at load (/Users/cblake/Documents/GitHub/campaigns-web/node_modules/node-gyp-build/node-gyp-build.js:22:10)
    at Object.<anonymous> (/Users/cblake/Documents/GitHub/campaigns-web/node_modules/microtime/index.js:1:43)
    at Module._compile (node:internal/modules/cjs/loader:1271:14)
    at Object..js (node:internal/modules/cjs/loader:1326:10)
    at Module.load (node:internal/modules/cjs/loader:1126:32)
    at node:internal/modules/cjs/loader:967:12
    at PackherdModuleLoader.origLoad (node:electron/js2c/node_init:2:13357)
    at PackherdModuleLoader.tryLoad (evalmachine.<anonymous>:1:755466)
    at Function.<anonymous> (evalmachine.<anonymous>:1:765680)
    at i._load (<embedded>:2939:67438)
    at Module.require (node:internal/modules/cjs/loader:1150:19)
    at require (node:internal/modules/cjs/helpers:121:18)
    at Object.<anonymous> (/Users/cblake/Documents/GitHub/campaigns-web/node_modules/@reportportal/agent-js-cypress/node_modules/@reportportal/client-javascript/lib/helpers.js:4:19)
    at Module._compile (node:internal/modules/cjs/loader:1271:14)
    at Object..js (node:internal/modules/cjs/loader:1326:10)
    at Module.load (node:internal/modules/cjs/loader:1126:32)
    at node:internal/modules/cjs/loader:967:12
    at PackherdModuleLoader.origLoad (node:electron/js2c/node_init:2:13357)
    at PackherdModuleLoader.tryLoad (evalmachine.<anonymous>:1:755466)
    at Function.<anonymous> (evalmachine.<anonymous>:1:765680)
    at i._load (<embedded>:2939:67438)
    at Module.require (node:internal/modules/cjs/loader:1150:19)
    at require (node:internal/modules/cjs/helpers:121:18)
    at Object.<anonymous> (/Users/cblake/Documents/GitHub/campaigns-web/node_modules/@reportportal/agent-js-cypress/lib/utils/objectCreators.js:18:23)
    at Module._compile (node:internal/modules/cjs/loader:1271:14)
    at Object..js (node:internal/modules/cjs/loader:1326:10)
    at Module.load (node:internal/modules/cjs/loader:1126:32)
    at node:internal/modules/cjs/loader:967:12
    at PackherdModuleLoader.origLoad (node:electron/js2c/node_init:2:13357)
    at PackherdModuleLoader.tryLoad (evalmachine.<anonymous>:1:755466)
    at Function.<anonymous> (evalmachine.<anonymous>:1:765680)
    at i._load (<embedded>:2939:67438)
    at Module.require (node:internal/modules/cjs/loader:1150:19)
    at require (node:internal/modules/cjs/helpers:121:18)
    at Object.<anonymous> (/Users/cblake/Documents/GitHub/campaigns-web/node_modules/@reportportal/agent-js-cypress/lib/utils/index.js:19:24)
    at Module._compile (node:internal/modules/cjs/loader:1271:14)
    at Object..js (node:internal/modules/cjs/loader:1326:10)
    at Module.load (node:internal/modules/cjs/loader:1126:32)
    at node:internal/modules/cjs/loader:967:12
    at PackherdModuleLoader.origLoad (node:electron/js2c/node_init:2:13357)
    at PackherdModuleLoader.tryLoad (evalmachine.<anonymous>:1:755466)
    at Function.<anonymous> (evalmachine.<anonymous>:1:765680)
    at i._load (<embedded>:2939:67438)
    at Module.require (node:internal/modules/cjs/loader:1150:19)
    at require (node:internal/modules/cjs/helpers:121:18)
    at Object.<anonymous> (/Users/cblake/Documents/GitHub/campaigns-web/node_modules/@reportportal/agent-js-cypress/lib/cypressReporter.js:43:5)
    at Module._compile (node:internal/modules/cjs/loader:1271:14)
    at Object..js (node:internal/modules/cjs/loader:1326:10)
    at Module.load (node:internal/modules/cjs/loader:1126:32)
    at node:internal/modules/cjs/loader:967:12
    at PackherdModuleLoader.origLoad (node:electron/js2c/node_init:2:13357)
    at PackherdModuleLoader.tryLoad (evalmachine.<anonymous>:1:755466)
    at Function.<anonymous> (evalmachine.<anonymous>:1:765680)
    at i._load (<embedded>:2939:67438)
    at Module.require (node:internal/modules/cjs/loader:1150:19)
    at require (node:internal/modules/cjs/helpers:121:18)
    at Object.<anonymous> (/Users/cblake/Documents/GitHub/campaigns-web/node_modules/@reportportal/agent-js-cypress/index.js:1:18)
    at Module._compile (node:internal/modules/cjs/loader:1271:14)
    at Object..js (node:internal/modules/cjs/loader:1326:10)
    at Module.load (node:internal/modules/cjs/loader:1126:32)
    at node:internal/modules/cjs/loader:967:12
    at PackherdModuleLoader.origLoad (node:electron/js2c/node_init:2:13357)
    at PackherdModuleLoader.tryLoad (evalmachine.<anonymous>:1:755466)
    at Function.<anonymous> (evalmachine.<anonymous>:1:765680)
    at i._load (<embedded>:2939:67438)
    at Module.require (node:internal/modules/cjs/loader:1150:19)
    at require (node:internal/modules/cjs/helpers:121:18)
    at A.loadReporter (<embedded>:2944:21800)
    at C.initializeReporter (<embedded>:2997:27000)
    at C.startWebsockets (<embedded>:2997:27304)
    at C.open (<embedded>:2997:25601)
    at async v.create (<embedded>:2997:40000)
    at async R (<embedded>:2997:79065)
    at async W (<embedded>:2997:92854)
@AmsterGet
Copy link
Member

Hello @chelseablake4 !
Could you please share the next info to help us reproduce the issue:

  1. The Node.js & npm versions used, your another package manager version if applicable.
  2. MacOS version where the mentioned error occurs
  3. If possible, could you please also share the way you perform the installation of the agent and its submodules (is it a regular)

As a quick workaround and while we are investigating the issue you can downgrade the agent-js-cypress version to 5.3.x.

@AmsterGet AmsterGet added the bug label Oct 2, 2024
@ssaleh-idexx
Copy link

@AmsterGet

Here is a repository I created with minimal code to trigger the error.

Steps

  • Run npm install
  • Run npm run cypress:run

Node/NPM versions tested (nvm used to manage Node versions)

  • node v22.9.0 (npm v10.8.3)
  • node v20.17.0 (npm v10.8.2)
  • node v18.20.4 (npm v10.7.0)

Machine

  • MacBook Pro
  • Chip: Apple M3 Pro
  • macOS: Sonoma 14.6.1

I will try upgrading to macOS 15 later today to see if that makes any difference.

@chelseablake4
Copy link
Author

Any update on this?

@AmsterGet
Copy link
Member

AmsterGet commented Oct 30, 2024

Hello @chelseablake4 , @ssaleh-idexx
This issue is definitely specific to M3.
We are still working on this, right now looks like we need to somehow provide a separate pre-built binary for M3 processors to use the microtime.. Or find the alternative.
I'll post in this thread once the issue will be resolved.

Meanwhile please use the agent-js-cypress version 5.3.5 while executing on M3 processors.

upd. Looks like the issue is actual for ARM processors (including other M-series), according to reportportal/agent-js-cypress#210.

@DzmitryHumianiuk
Copy link
Member

TL;DR: We are removing microseconds support from the JS agent, reverting it back to milliseconds (as it has always been).

Here are my thoughts on this, along with some broader context to explain where this change is coming from.

As part of various requests to ReportPortal, we received multiple inquiries about adding microseconds support and ensuring proper ordering. The issue was that when microseconds were rounded to milliseconds, they were stored in the database in the order they were processed by the API. Since requests are handled asynchronously, this sometimes led to log entries within the same millisecond appearing out of order. This was particularly relevant for companies testing robotics or high-frequency operations.

We implemented microseconds support on the API side, allowing timestamps for logs to be submitted with higher precision. This, in turn, required all agents using the API to be updated for compatibility with the new format.

Unfortunately, Node.js does not support microseconds natively and lacks a built-in time object that returns them. To work around this, we used a third-party C++ library that provided microsecond precision.

However, this library has compatibility issues with Apple Silicon chips (M-series). While some versions of macOS have fixed it for specific chip models, new M-series versions remain unsupported. As a result, we’ve observed ongoing issues with M1, M2, and now M4 chips.

Until there is a stable library that works across all Apple Silicon versions, or Node.js adds native microsecond support, or we identify a reliable library that fully resolves the issue across platforms, I believe we should remove microseconds support from the JS agent.

If you come across anything that changes this situation, please let us know.

@AmsterGet
Copy link
Member

Fixed in the client version 5.4.0 according to the comment above.
Fixed in agent-js-cypress in the scope of version 5.5.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants