Skip to content
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

Handle ssl errors #54

Merged
merged 1 commit into from
Sep 30, 2019
Merged

Handle ssl errors #54

merged 1 commit into from
Sep 30, 2019

Conversation

dpopp07
Copy link
Member

@dpopp07 dpopp07 commented Sep 27, 2019

Adds a specific handler for ICP SSL errors. Also fixes the dreaded "Body is HTTP blah blah" error with a more descriptive one.

…nstances

* return correct data for requests that don't connect
* add some types to local variables in request wrapper
@mediumTaj
Copy link
Member

dustin was this meant to go to master?

@dpopp07 dpopp07 changed the base branch from master to release-v1-rc2 September 27, 2019 20:45
@dpopp07
Copy link
Member Author

dpopp07 commented Sep 27, 2019

Nope, updated

Copy link
Member

@mediumTaj mediumTaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 looks good!

@codecov
Copy link

codecov bot commented Sep 27, 2019

Codecov Report

Merging #54 into release-v1-rc2 will increase coverage by 0.07%.
The diff coverage is 100%.

Impacted file tree graph

@@                Coverage Diff                 @@
##           release-v1-rc2      #54      +/-   ##
==================================================
+ Coverage           95.71%   95.79%   +0.07%     
==================================================
  Files                  23       23              
  Lines                 584      595      +11     
  Branches              125      130       +5     
==================================================
+ Hits                  559      570      +11     
  Misses                 24       24              
  Partials                1        1
Impacted Files Coverage Δ
lib/requestwrapper.ts 85.5% <100%> (+1.25%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8dcde61...afcc9f9. Read the comment docs.

Copy link
Contributor

@mkistler mkistler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! 👍

@dpopp07 dpopp07 merged commit 6a62f44 into release-v1-rc2 Sep 30, 2019
@dpopp07 dpopp07 deleted the handle-ssl-errors branch September 30, 2019 14:10
// when a request to a private cloud instance has an ssl problem, it never connects and follows this branch of the error handling
if (isSelfSignedCertificateError(axiosError)) {
error.message = `If you're trying to call a service on ICP or Cloud Pak for Data, you ` +
`may not have a valid SSL certificate. If you need to access the service without setting that up, try using ` +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about?

The service you are trying to call doesn't use valid certificates. You can disable the SSL certificate validation using the disableSslVerification option.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with that. I just copied the message that @lpatino10 has in Java for consistency. Would you rather this change?

@SirSpidey
Copy link

SirSpidey commented Sep 30, 2019

We usually state the error and the possible response. How about this?

The connection failed because the SSL certificate is not valid. To use a self-signed certificate, set the disableSslVerification parameter inHttpConfigOptions.

@dpopp07
Copy link
Member Author

dpopp07 commented Sep 30, 2019

I'm fine with any of these. I just think that currently, all of the other SDKs are using the message in the PR, so do we want to change all of them? @mediumTaj

@mediumTaj
Copy link
Member

Yes once we settle i will create an issue

dpopp07 added a commit that referenced this pull request Oct 3, 2019
…nstances (#54)

* return correct data for requests that don't connect
* add some types to local variables in request wrapper
dpopp07 added a commit that referenced this pull request Oct 3, 2019
…nstances (#54)

* return correct data for requests that don't connect
* add some types to local variables in request wrapper
ibm-devx-automation pushed a commit that referenced this pull request Oct 3, 2019
# [1.0.0](v0.3.6...v1.0.0) (2019-10-03)

### Bug Fixes

* Move check for serviceUrl to createRequest ([#47](#47)) ([6f04739](6f04739))
* parse result from response in token managers ([6bbe423](6bbe423))
* provide bundlers alternate file for browser support ([#58](#58)) ([88a9d16](88a9d16))

### Build System

* drop support for Node versions 6 and 8 ([#33](#33)) ([d47c737](d47c737))

### Code Refactoring

* look for credentials file in working dir before home dir ([#46](#46)) ([c5556de](c5556de))
* return detailed response as second callback argument ([#34](#34)) ([dc24154](dc24154))

### Features

* add `setServiceUrl` method as a setter for the `serviceUrl` property ([#41](#41)) ([cfb188f](cfb188f))
* add specific error handling for SSL errors with cloud private instances ([#54](#54)) ([056ec9a](056ec9a))
* export `UserOptions` interface from the BaseService ([#50](#50)) ([4f0075a](4f0075a))
* implement new authenticators to handle sdk authentication ([#37](#37)) ([f876b6d](f876b6d))
* refactor core to use Promises instead of callbacks ([#55](#55)) ([9ec8afd](9ec8afd))

### BREAKING CHANGES

* None of the authenticators or request methods take callbacks as arguments anymore - they return Promises instead.
* Users that have credential files in both the working directory and the home directory will see a change in which one is used.
* The internal property `url` no longer exists on the `baseOptions` object, it has been renamed to `serviceUrl`
* The old style of passing credentials to the base service will no longer work. An Authenticator instance MUST be passed in to the base service constructor.
* token managers no longer support user access tokens. use BearerTokenAuthenticator instead
* The class names of the token managers have changed.
* `Icp4dTokenManagerV1` renamed to `Cp4dTokenManager`
* `IamTokenManagerV1` renamed to `IamTokenManager`
* `JwtTokenManagerV1` renamed to `JwtTokenManager`
* The public method `setAuthorizationInfo` is renamed to `setClientIdAndSecret`
* The response body is no longer the 2nd callback argument, the detailed response is. The body is located under the `result` property. The `data` property is removed.
* This SDK may no longer work with applications running on Node 6 or 8.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants