Coder Social home page Coder Social logo

Comments (11)

okbel avatar okbel commented on April 28, 2024 1

Hey! Thanks for bringing this up. We're already working on it. 👍

from examples.

leerob avatar leerob commented on April 28, 2024 1

#156

from examples.

sgharms avatar sgharms commented on April 28, 2024 1

@ValentinH

We were unable to log (locally) in the middleware as fs is not available.

The PR suggests that fetch() is available as an alternative.

For us, this meant using a custom server (in docs) to get this functionality. It’s discouraged by vercel as one loses some optimizations, but I didn’t see any other way to get local logging.

good news: the server code is fairly easy and the docs are solid.

from examples.

ValentinH avatar ValentinH commented on April 28, 2024 1

I've gone through the custom server path in the past but this time we are hosted on Vercel so we want to stay on the default setup. 😞

from examples.

sgharms avatar sgharms commented on April 28, 2024 1

Seems like there is community desire for access to some/all of the node runtime in the middleware.

Having to fetch() POST just to get basic telemetry data seems unnecessarily complex.

from examples.

oswaldoacauan avatar oswaldoacauan commented on April 28, 2024

I had a very frustrating evening yesterday trying to find a simple logging middleware example. The docs pointing nowhere was not very helpful also.

I see this as a basic feature for a framework that is to be production ready and same goes for Telemetry which there is no examples to be found.

from examples.

oswaldoacauan avatar oswaldoacauan commented on April 28, 2024

@okbel thanks for the update 🙏🏻 . Is there any estimated date for the logging, telemetry and instrumentation examples?

from examples.

sgharms avatar sgharms commented on April 28, 2024

I think @leerob has offered something formidable, and it is definitely an improvement that should be included; however, for simplicity’s sake and to establish a general pattern, I’d like to see something where the log file is written on the same machine as the next instance.

I’m wondering if we can squint and see the Vercel business model: if calls are processed on lambdas, there’s no local persistence and an approach like #156 makes sense :). I’d argue that for developing middleware and dev mode in general that models for local persistence be demonstrated (or, I suppose, clearly rejected in the documentation so that those considering next middleware see this limitation up front).

from examples.

leerob avatar leerob commented on April 28, 2024

I’d like to see something where the log file is written on the same machine as the next instance.

This isn't a pattern we want to advocate for, whether you're running serverfull or serverless.

I’m wondering if we can squint and see the Vercel business model: if calls are processed on lambdas, there’s no local persistence and an approach like #156 makes sense.

Next.js works open-source, on whatever infra you provide, so it's not really about Vercel's serverless infra - more so that when we talk to companies building with Next.js, they aren't persisting logs to a local file, but rather ingesting them into some logging system 👍

from examples.

ValentinH avatar ValentinH commented on April 28, 2024

Talking about ingesting them, we are facing issues with winston not being able to run in the Edge runtime. Is it a known issue? What logger do you recommend for logging in middlewares?

from examples.

lfades avatar lfades commented on April 28, 2024

Closing as per #164 (comment)

To provider more context, Middleware can be executed multiple times for the same path, and we don't have a reliable way to send logs at 1. the right time and 2. while avoiding sending it twice.

The logging and analytics example have been removed until we have a more appropriate solution for it.

from examples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.