Skip to content

Unhandled 'error' event for the initial example #33

Description

@sbcgua

Describe the bug
The (slightly modified) example from the docs results in Unhandled 'error' event.
Although the logs were successfully sent (!).

To Reproduce

import fs from 'node:fs';
const CRED_FILE_PATH = './path-to-credentials.json';
const creds = JSON.parse(fs.readFileSync(CRED_FILE_PATH, 'utf-8'));

import pino from 'pino';
const logger = pino({
    transport: {
        target: 'cloud-pine',
        options: {
            logName: 'my_cloud-pine',
            cloudLoggingOptions: {
                googleCloudOptions: {
                    projectId:   creds.project_id,
                    credentials: creds,
                },     
            }
        }
    }
});

logger.info('Hello from pino');
logger.error({ andSomedata: 1 }, 'Pino Error');

Expected behavior
No errors, graceful exit

Screenshots

$node pino.js
node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: end() took too long (10s)
    at end (C:\Users\...\test-google-logs\node_modules\thread-stream\index.js:406:15)
    at ThreadStream.end (C:\Users\...\test-google-logs\node_modules\thread-stream\index.js:258:5)
    at autoEnd (C:\Users\...\test-google-logs\node_modules\pino\lib\transport.js:75:10)
    at process.wrap (C:\Users\...\test-google-logs\node_modules\on-exit-leak-free\index.js:10:7)
    at Object.onceWrapper (node:events:628:26)
    at process.emit (node:events:513:28)
Emitted 'error' event on ThreadStream instance at:
    at destroy (C:\Users\...\test-google-logs\node_modules\thread-stream\index.js:349:12)
    at end (C:\Users\...\test-google-logs\node_modules\thread-stream\index.js:415:5)
    at ThreadStream.end (C:\Users\...\test-google-logs\node_modules\thread-stream\index.js:258:5)
    [... lines matching original stack trace ...]
    at process.emit (node:events:513:28)

Desktop (please complete the following information):

  • OS: Windows 10
  • Nodejs: v18.16.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions