Closed vitortolentino closed 5 years ago
Wow I'm not sure how you could be getting this. I can't reproduce it with the versions you provided.
Nodejs added support for unref on all timers a long time ago. It's certainly in node 12.8 https://nodejs.org/api/timers.html#timers_timeout_unref
would you confirm your nodejs version and try on the most recent node 12?
On my Linux machine with the same Node version, npm version, and @google-cloud/logging-bunyan
version, I am also not seeing any issues using the logging buyan library.
In particular, here is the code I am using:
const bunyan = require('bunyan');
const LoggingBunyan = require('@google-cloud/logging-bunyan');
const express = require('express');
const loggingBunyan = new LoggingBunyan.LoggingBunyan();
const logger = bunyan.createLogger({
name: 'my-service',
streams: [
{stream: process.stdout, level: 'info'},
loggingBunyan.stream('info'),
],
});
const app = express();
app.get('/', (req, res) => {
logger.error('warp nacelles offline');
logger.info('shields at 99%');
res.send('Hello world and stuff');
});
const port = process.env.PORT || 8080;
app.listen(port, () => {
console.log(`Listening on port ${port}`);
});
When I run this, I don't get any errors running the code, and (after doing gcloud auth application-default login
if needed), the logs correctly appear in the cloud console.
I just wanted to share what my code looks like that is working. The only difference I can see is that you are on OS X, but I don't see how that could cause the problem you are seeing.
Is your code in JavaScript or TypeScript? Perhaps that is an issue.
@Antimaterium had this problem when he was running tests with jest.
We could solve this issue by just setting the testEnvironment
config to node
because it uses jsdom
as default.
Thank you
Thanks for the update. I'm going to close this issue since it looks like the underlying issue was found as a jest configuration.
I get the following error while trying to import the dependency:
Environment details
@google-cloud/logging-bunyan
version: 1.2.3