Hi, I tried the Next.js App Router example. (#122)
I modified the middleware to log error.
Before
|
export function middleware(request: NextRequest) { |
|
rollbar.configure({ payload: { context: request.nextUrl.pathname } }); |
|
|
|
return NextResponse.next(); |
|
} |
After
export function middleware(request: NextRequest) {
rollbar.configure({ payload: { context: request.nextUrl.pathname } });
rollbar.error('error!', (err, response) => {
// insufficient privileges: post_client_item scope is required but the access token only has post_server_item.
console.log('error', err, response);
});
return NextResponse.next();
}
But as commented above, this causes insufficient privileges error.
If I change the server token to a client post token here:
|
accessToken: process.env.POST_SERVER_ITEM_TOKEN, |
The middleware can log the error.
But should I use the client post token in the middleware?
Is there a way to recommend?
Hi, I tried the Next.js App Router example. (#122)
I modified the middleware to log error.
Before
rollbar-react/examples/nextjs-approuter/src/app/middleware.ts
Lines 4 to 8 in 418412d
After
But as commented above, this causes
insufficient privilegeserror.If I change the server token to a client post token here:
rollbar-react/examples/nextjs-approuter/src/rollbar.ts
Line 15 in 418412d
The middleware can log the error.
But should I use the client post token in the middleware?
Is there a way to recommend?