Write to BigQuery from Worker running in China

BigQuery seems blocked in China, at least with a direct url access.

I wonder if I can write to BigQuery through a Worker running in China ?

Use case:
While running a Worker to do server stuff, I’d like to log information as payment errors, payment success, …etc., in BigQuery, in order to display later this information in a Data Studio Dashboard, reading from BigQuery

In terms of the possibility, as long as it’s possible using HTTP requests (and no custom TCP/UDP/etc protocols or anything) you can do it from a worker using fetch() calls.

If you have China network enabled (which is Enterprise only), then your workers in China will most likely also be blocked from accessing Google IPs, although I’d try it before ruling out direct connections. Your best bet in this case would probably be a self-hosted level 7 proxy to whatever BQ hostname you need to access.

1 Like

Thank you for your fast reply !
That enlights me a lot.

Another solution I was thinking could be to write logs in a topic in DO, then, somehow having an outside China Client opening a WebSocket to the DO topic through a Worker outside China, and inside this Worker, read last messages from the DO topic, then write into Big Query messages older than the last write date.

You can use Logflare and we’ll write to your BigQuery tables for you and detect fields, manage the schema etc.

1 Like