Adrian
Adrian

Reputation: 5681

Exception ALPN is not configured properly

I'm trying to create some cloud metrics from scala using scio and apache beam for a dataflow task.
I get the following error:

java.lang.IllegalArgumentException: ALPN is not configured properly. See https://github.com/grpc/grpc-java/blob/master/SECURITY.md#troubleshooting for more information.

I followed the steps at that URL and added a JVM param: -Djavaagent=/Users/user/Downloads/jetty-alpn-agent-2.0.6.jar

I also have as env var: GOOGLE_APPLICATION_CREDENTIALS=/etc/recsys/recsys-dev.json

The code:

val pathToCredsFile = "/etc/recsys/recsys-dev.json"
val credentials = GoogleCredentials.fromStream(new FileInputStream(pathToCredsFile)).createScoped(Lists.newArrayList("https://www.googleapis.com/auth/cloud-platform"))
val settings = MetricServiceSettings.newBuilder()
  .setCredentialsProvider(FixedCredentialsProvider.create(credentials))
  .build()
val metricServiceClient = MetricServiceClient.create(settings) <-throws ex whether or  not I use settings

Can I get some help?

Upvotes: 0

Views: 3566

Answers (2)

KayV
KayV

Reputation: 13855

You can add usePaneText() method before build() to solve the ALPN not configured issue as follows:

val settings = MetricServiceSettings.newBuilder()
  .setCredentialsProvider(FixedCredentialsProvider.create(credentials))
  .userPlainText()
  .build()

This will disable SSL for testing or dev env.

Note: not recommended for prod env.

Upvotes: 0

Eric Anderson
Eric Anderson

Reputation: 26464

Try looking at the Google Cloud Java Troubleshooting document, specifically the compatibility checker. Providing its output would be helpful for debugging.

jetty-alpn-agent-2.0.6 does not support JRE versions 1.8.0u161 and later. Upgrading to 2.0.7 or 2.0.9 may work better. But using jetty-alpn is discouraged. If you are using a supported platform, tcnative or Conscrypt are better alternatives.

There should also be some INFO logs with some additional details of what was wrong with Jetty ALPN/tcnative/Conscrypt (look for "netty-tcnative unavailable (this may be normal)"; there will be one log statement for each ALPN provider, with backtraces).

Upvotes: 0

Related Questions