Skip to content

Support structured logging for Vercel 'edge' functions #51

@tchief

Description

@tchief

Hi @chasers, thanks for the product!

Setup

Next.js project with middleware deployed to Vercel with pino-logflare.

Problem

Attempt to use logger either directly or via new child inside middleware

logger.info({ name: 'abc' }, 'In middleware');
...
const currentLogger = logger.child({ source: 'middleware' });
currentLogger.info({ name: 'abc' }, 'In middleware');

lead to edge function crash with message

"message": "[EvalError: Code generation from strings disallowed for this context]",
"source": "edge",
"type": "fatal"

Using console.log does not parse message into parsedLambdaMessage or similar property inside middleware.

Questions

  1. Can I setup logger in a way it supports structured logging inside edge function?
  2. Do you plan to include property similar to 'parsedLambdaMessage' for Vercel's edge functions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions