Next.js Discord

Discord Forum

Need to intercept all API calls and replay them

Unanswered
harshcut posted this in #help-forum
Open in Discord
hey guys! i work on a react application which has very unstable backend. the api responds with 4xx/5xx quite often. i am in need of an app/extension which can record all my network requests and replay them again for future requests made to the same endpoint. does anyone know any such app that can help here?

2 Replies

@harshcut hey guys! i work on a react application which has very unstable backend. the api responds with 4xx/5xx quite often. i am in need of an app/extension which can record all my network requests and replay them again for future requests made to the same endpoint. does anyone know any such app that can help here?
you can archive this by tracing your clients requests. Log important events, traces the requests and if you want to, get some metrics out of them: https://nextjs.org/docs/app/guides/open-telemetry

The guide is pretty straight forward:
1. Install some dependencies
2. Add an instrumentation file

And you are done ^^

You may need to adjust your functions a bit, so the needed data is recorded, but thats it
@harshcut solved?