fix: prevent Cypress from crashing when getting machine-id fails#22119
fix: prevent Cypress from crashing when getting machine-id fails#22119tgriesser merged 2 commits intocypress-io:developfrom
Conversation
|
Thanks for taking the time to open a PR!
|
flotwig
left a comment
There was a problem hiding this comment.
@Swaana I was unable to reproduce this bug, even with a non-admin user account and the "Prevent access to registry editing tools" policy, but your changes make sense to me and look like they would catch the error, so I'll approve.
@tgriesser is this another example of something that we could catch higher up in the data-context in GUI mode?
@flotwig This is another example of an cypress/packages/server/lib/unhandled_exceptions.js Lines 1 to 7 in e2243ee |
|
@tgriesser we should exit on |
|
It's because we're not try {
return nmi.machineId()
} catch (error) {
return undefined
}vs try {
return await nmi.machineId()
} catch (error) {
return undefined
}the former will lead to an Has nothing to do with GraphQL, it's more to do with the fact that we're now using async/await rather than promise chains everywhere and not always ensuring there's proper awaiting. I think it's something we can introduce linting for but IIRC there were problems with false positives & negatives. |
User facing changelog
The GUI will continue to run if getting machine-id fails.
Additional details
The underlying npm package
node-machine-idrequires admin rights on Windows to get the machine id. This is causing the Cypress GUI to crash for Windows users that do not have administrator rights. The fix will allow for the failure as the ID is optional.Steps to test
To test this it requires a Windows machine and a non-admin user. Perhaps also an extra setting to prevent the user from running
%windir%\System32\REG.exe. Running Cypress without this change will cause the application to crash right after selecting the type of test to perform, and after the change the application will run as normal.How has the user experience changed?
The GUI will continue to run if getting machine-id fails.
PR Tasks
cypress-documentation?type definitions?