Comments (11)
Hey! Thanks for bringing this up. We're already working on it. 👍
from examples.
from examples.
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.
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.
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.
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.
@okbel thanks for the update 🙏🏻 . Is there any estimated date for the logging, telemetry and instrumentation examples?
from examples.
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.
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.
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.
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)
- [examples/solutions/monorepo] "pnpm dev" show error HOT 1
- postgres-prisma example internal server error on live link HOT 1
- NestJS/Flask template not working
- NestJS/flask3 Demo URL in website is not working
- AWS DynamoDB Example is broken
- nextjs-flask example broken HOT 6
- Clarification on the "@acme-" Prefix in Multi-Zones Packages
- postgres-pgvector demo site not working HOT 1
- Web3 Authentication example is insecure HOT 1
- Next.js + Flask fails in production HOT 2
- Microfrontends example: Module not found: Can't resolve './example.module.css'
- feat(storybook): introduce to `/solution/monorepo`
- Bug: Wrong header in `https://app-dir-i18n.vercel.app/` HOT 1
- nextjs-flask: The flask api endpoint is not working. HOT 2
- Your location is undefined HOT 5
- PostgreSQL on docker and Next.js locally Error: connect ECONNREFUSED ::1:443 HOT 1
- Node.js Serverless Function template doesn't work (gives a 404) HOT 2
- Update deployment GitHub workflows
- bug
- Domain API Example broken
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from examples.