PipedreamHQ / PipedreamHQ/pipedream

[BUG] logging facility not working OOTB on Pipedream

Open
#13,051 1 comment 0 reactions 0 assignees View on GitHub
bug tracked internally triaged
Dominant language
JavaScript
Stars
11.7k
Forks
5.8k
Avg merge
3d 10h
Merged PRs (30d)
102

Description

**Describe the bug**

I am trying to use [`pino`](https://github.com/pinojs/pino) via [`pino-pretty`](https://github.com/pinojs/pino-pretty/) within a pipedream action, as such:

```js
import pino from 'pino';
import pretty from 'pino-pretty';

const stream = pretty({
sync: true
});
const logger = pino({
level: 'info',
}, stream);

export default defineComponent({
async run({ steps, $ }) {

logger.info('Test')
},
})
```

**To Reproduce**
Steps to reproduce the behavior:
1. Create a new node step
2. Paste the above code
3. Run it
4. Observed that there's no log found on the Log tab

**Expected behavior**
See `[12:11:43.032] INFO (12557): Test` in the log tab.

**Screenshots**
This is from a local execution of the code above:

![2024-07-31_12-12](https://github.com/user-attachments/assets/4c7cdaec-34c3-42ec-8855-6b29053bd73a)

**Additional context**

I already switched the logger to synchronous mode, but it seems like there is an issue with the [sonic boom library](https://github.com/pinojs/sonic-boom) on Pipedream, so messages get lost, most likely because it uses a file descriptor to write. If I direct pino-pretty to directly use `process.stdout`, it works:

```js
import pino from 'pino';
import pretty from 'pino-pretty';

const stream = pretty({
sync: true,
destination: process.stdout,
});
const logger = pino({
level: 'info',
}, stream);

export default defineComponent({
async run({ steps, $ }) {

logger.info('Test')
},
})
```
(note the additional property `destination: process.stdout,`, see https://github.com/pinojs/pino-pretty/blob/7830286b10c6549789fbe5a2afaa74a517870f60/index.js#L158)

which makes me think there's an issue with writing to the process file descriptor on pipedream.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.