Hang inside Docker container
See original GitHub issueI have a docker-compose.yml
file that runs integration tests, which includes talking to Pub/Sub. It looks like this:
version: "3.4"
services:
app:
image: node:10-alpine
volumes:
- ./:/app:ro
working_dir: /app
environment:
- GOOGLE_APPLICATION_CREDENTIALS=/app/service_account.json
entrypoint:
- npm
- run
- test-e2e-debug
The tests hang when the call to publish()
takes place. The relevant code:
exports = module.exports = async (data) => {
const dataBuffer = Buffer.from(JSON.stringify(data));
const topic = pubsub.topic(topicName, {
batching: {
maxMessages: 1, // max messages per batch
maxMilliseconds: 50, // max wait time (ms) per batc
},
});
const { publisher } = topic;
const messageId = await publisher.publish(dataBuffer);
log.error({ messageId }, 'pubsub complete');
return messageId;
};
Running the same function outside the container, directly on my machine, works without issue. I’m using service account JSON creds with GOOGLE_APPLICATION_CREDENTIALS
set in my environment, both in the container and outside.
Incidentally, when I configured GOOGLE_APPLICATION_CREDENTIALS
to a nonexistent filename, it did cause an error to be thrown, so I assume the correct filename I’ve now set is being picked up correctly.
I’ve done a little debugging inside the pubsub client and can confirm that publish_()
is called, but then it simply hangs. Running it in the debugger with ‘pause on caught exceptions’ causes no break. The request callback in publish_()
never gets fired.
So my issue is two-fold:
- why the hang inside my container, rather than chucking out an error somewhere? (is there a retry-backoff loop going on?)
- how do I correctly configure authentication when running inside a container, given service account JSON credentials?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
Thanks for checking in. It looks like this was resolved in some version after v0.30.0. It now properly throws an
Unable to detect a Project Id in the current environment.
error instead of locking. This issue can be closed now.Awesome, thanks for the update @JeremyPlease!