americanexpress / nodes

A GraphQL JVM Client - Java, Kotlin, Scala, etc.
Apache License 2.0
307 stars 70 forks source link

Unable to make https calls using this client . #33

Closed bpillai closed 5 years ago

bpillai commented 5 years ago

The client seems to be using httpurlconnection to make the graph ql api calls . This restricts making calls to https .

chemdrew commented 5 years ago

Can you please provide the error message? httpurlconnection is still capable of making https calls, it is doing so in samples/kotlin-sample/src/main/kotlin/Main.kt as well as samples/scala-sample/src/main/scala/Main.scala when querying against the GitHub v4 open api.

bpillai commented 5 years ago

sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

bpillai commented 5 years ago

GraphQLException{message='null', status='null', description='sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target', errors=null}\n\tat io.aexp.nodes.graphql.Fetch.send(Fetch.java:84)\n\tat io.aexp.nodes.graphql.GraphQLTemplate.execute(GraphQLTemplate.java:83)\n\tat io.aexp.nodes.graphql.GraphQLTemplate.query(GraphQLTemplate.java:42)

bpillai commented 5 years ago

Also is there a reason to use httpUrlConnection over httpsUrlConnection ?

bpillai commented 5 years ago

I want to be abe to load a keystore file while opening the connection . If thhis client is used in a serverless app , then to be able to call a https which mandates a cert we would have to load it while opening the connection . I believe that is currently not possible .

chemdrew commented 5 years ago

Hi @bpillai, the reason I chose httpUrlConnection over httpsUrlConnection is because I wanted the library to support http as well as https (see this). Your error looks unrelated to this library and more of an issue with loading your keystore into the jvm. Loading your keystore can be done in many ways based on your application and how it is run, you can find many articles and posts on doing this each way. Closing this issue out.