Skip to content

Conversation

@BartoszKlonowski
Copy link
Contributor

@BartoszKlonowski BartoszKlonowski commented Dec 2, 2020

This pull request fixes #6281

Changes introduced in this PR provide the project with enhanced error printed when generating a self-signed certificate fails for any reason. The timeout set for generating the self-signed certificate is removed.


The implementation of this fix contains two main changes:

  • Remove the timeout set for a powershell command creating the self-signed certificate.
    This allows any machine to generate the self-signed certificate no matter how slow it is (please see the linked issue).
    Another idea was to make this timeout value configurable, but in the end it would just reduce the comfort of creating the RNW project, as the timeout would be one of the arguments, or it would be default
    (leaving it as default would require changing the value, but to which value would be risky, as we never know how slow some developer's machine can be).
  • Enhance the error printed by the generateCertificate() function, by printing the original err message in additional to general dispatch saying that the generating failed.

For more information about the implementation please see the commit messages.


Results of changes provided in this pull request are presented below:

When the self-signed certificate generating fails (in this example the timeout was still implemented) the error is printed in red color right under the general failure message:
obraz

After removing the timeout completely, the self-signed certificate is created without any issue:
obraz

Microsoft Reviewers: Open in CodeFlow

The `generateCertificate()` function had the try-catch result given only
as the general failure message.
To keep the user aware of issues during the RNW setup, this self-signed
certificate generating try-catch block has been provided with the
additional information included in the exception argument: err.

Please note, that only the err is displayed, instead of extending it
with additional parameters (such as ERRNO, or path) as these are
developers details and it keeps the error message informative but still
short.
The timeout set to 10 seconds when generating the self-signed
certificate was causing the error on slower machines for developers.
Please see:
#6281

The idea was also to make this timeout value configurable, but in the
end this solution would just make each developer leave it as default
(magic number 10) or set it to max just so it's not needed to be set
again. This could also result in trials and errors when trying to set
the proper timeout value, which would make using the RNW uncomfortable.
@BartoszKlonowski BartoszKlonowski requested a review from a team as a code owner December 2, 2020 08:54
@ghost ghost added the Area: CLI label Dec 2, 2020
@ghost
Copy link

ghost commented Dec 2, 2020

CLA assistant check
All CLA requirements met.

@NickGerleman
Copy link
Contributor

Giving to ACoates who added the timeout in #4430

@NickGerleman
Copy link
Contributor

NickGerleman commented Dec 2, 2020

Just realized that ACoates is out of office.

My sense is that the timeout isn't the right thing to do here, but from issue history it looks like a mitigation against unexplained hangs.

Removing it seems fine to me, but would love to have a separate strategy for discovering root cause or mitigating these hangs in the wild. Better logging helps here, but I also wonder if it would make sense to add a CLI flag or fallback to temp keys for if customers do hit the issue.

@dannyvv dannyvv merged commit 63d5e9f into microsoft:master Dec 2, 2020
@dannyvv
Copy link
Member

dannyvv commented Dec 2, 2020

@BartoszKlonowski: Thank you for your contribution to react-native-windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Timeout can cause failure to create self-signed certificate on slower machines.

4 participants