Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pino rejecting a valid json format in case of error passed as object. #1875

Open
jindalAnuj opened this issue Jan 5, 2024 · 1 comment
Open

Comments

@jindalAnuj
Copy link

this.logger.error({
      type: LogType.error,
      log: logPayload,
    });
 

// log payload with type , complete json
{
  type: 'Error',
  log: {
    message: 'Error occurred while getting vertical',
    metadata: {
      error: Error: Failed to list get verticals
          at **********)
          at processTicksAndRejections (node:internal/process/task_queues:96:5)
          at **********)
    }
  }
}
    
    // output
    {"level":50,"time":1704439345847,"pid":72737,"hostname":"ip-192-168-1-34.ap-south-1.compute.internal","context":"OfflineVerticalService","type":"Error","log":{"message":"Error occurred while getting vertical","metadata":{"error":{}}}}
    
    
  
  • as we can see error object is getting reject. This only happens in case of few error type like typeError
@mcollina
Copy link
Member

mcollina commented Jan 5, 2024

Errors are special objects that must be manually serialized. I'm guessing that you have not installed a proper serializer for it (there is no reproduction in the OP, just a snippet).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants