bigquery-emulator icon indicating copy to clipboard operation
bigquery-emulator copied to clipboard

Hangs on BigqueryWriteClient.createWriteStream

Open ricardoeriveros opened this issue 1 year ago • 2 comments

I'm using Bigquery Storage Write API and it seems to be hanging createWriteStream call. Basically tried running the example for pending type here,

https://cloud.google.com/bigquery/docs/write-api-batch#batch_load_data_using_pending_type

I did change the example to use emulator like so

BigQueryWriteSettings bigQueryWriteSettings = BigQueryWriteSettings.newBuilder() .setEndpoint("localhost:9060") .build(); BigQueryWriteClient client = BigQueryWriteClient.create(bigQueryWriteSettings);

ricardoeriveros avatar May 15 '23 13:05 ricardoeriveros

I came to this issue since I ran into the same problem. But this one is in the java client library. It's retrying a secure connection, but the service is plaintext.

I'm not sure if it's the best solution, but configuring a NettyChannel this way is working for me:

        BigQueryWriteSettings.newBuilder()
            .setCredentialsProvider {
              OAuth2Credentials.newBuilder()
                  .setAccessToken(AccessToken("token", Date(4102444800000)))
                  .build()
            }
            .setEndpoint("127.0.0.1:$rpcPort")
            .setTransportChannelProvider(
                FixedTransportChannelProvider.create(
                    GrpcTransportChannel.newBuilder()
                        .setManagedChannel(
                            NettyChannelBuilder.forAddress("127.0.0.1", rpcPort)
                                .usePlaintext()
                                .build())
                        .build()))
            .build())

I couldn't get NoCredentials to work for this. The NettyChannel doesn't seem set up to handle that object.

seanmcnealy avatar Jun 28 '23 11:06 seanmcnealy

FYI I have the following and this part work fine

BigQueryWriteSettings.newBuilder()
  .setCredentialsProvider(NoCredentialsProvider.create())
  .setEndpoint(url)
  .setTransportChannelProvider(
    BigQueryWriteSettings.defaultGrpcTransportProviderBuilder()
      .setChannelConfigurator(_.usePlaintext())
      .build(),
  )
  .build()

gpoulin avatar Nov 22 '23 18:11 gpoulin