You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a fetch in App Router based API route using router and the fetch is not being picked up by the nextjs adapter. Other fetchs are, either in RSCs or in the client, so the adapter is configured properly.
I notice the example nextjs application doesn't have API routes. Might help to add those to make sure that calls made through those get collected properly.
The text was updated successfully, but these errors were encountered:
For example, the below implementation does show the trace in Envy.
importaxiosfrom'axios';import{NextResponse}from'next/server';constSWAPI_URL='https://swapi.dev/api/people/1';exportasyncfunctionGET(){const{ data }=awaitaxios.get(SWAPI_URL);// ✅ request shows in EnvyreturnNextResponse.json(data);}
However, change from using axios to using fetch and Envy doesn't see the request:
import{NextResponse}from'next/server';constSWAPI_URL='https://swapi.dev/api/people/1';exportasyncfunctionGET(){constresp=awaitfetch(SWAPI_URL);// ❌ request doesn't show in Envyconstdata=awaitresp.json();returnNextResponse.json(data);}
My suspicion is that we need to ensure that the @envyjs/nextjs adapter patches the fetch operation for the server just like it does for the client in the @envyjs/web adapter.
I have a fetch in App Router based API route using router and the fetch is not being picked up by the nextjs adapter. Other fetchs are, either in RSCs or in the client, so the adapter is configured properly.
I notice the example nextjs application doesn't have API routes. Might help to add those to make sure that calls made through those get collected properly.
The text was updated successfully, but these errors were encountered: