-
Notifications
You must be signed in to change notification settings - Fork 27
Support for Next 13 App Folder and Root Layout #154
Comments
I'm also having this issue. any workaround? |
Hi there ! |
Ok, I finally succeded ! ./app/layout.js :
You will have to go to Newrelic web site and copy/paste the javascript part of the snippet, in the settings of your app (Browser section). Then create you snippet React component : ../components/newrelicSnippet.jsx :
And that worked for me. |
@bizob2828 is there some fix for this issue? The workaround provided by @pyleglise works, but in my scenario, it is not so feasible, since this must be applied to tens of apps deployed to different environments/different new relic accounts. |
I'm not getting logs from Pino with this approach. Although other things are working like traces and JS errors. |
There's probably a better way to do this and if there is please tell me. I wanted to try @pyleglise 's suggested solution but I didn't have the snippet itself because all the guides instruct you to get the snippet via the So I did the following to obtain the snippet code.
It works. It's hacky. I hope the snippet doesn't change from time to time. But it works. Now please tell me how wrong I am. |
I was able to resolve this by adding the following to next.config.js
Reference: vercel/next.js#52876 |
Are there any updates on this topic? I got it working, but still seeing the errors while yarn build in my next application. I added to config in next.config.js as @samkit5495 described above, and integrated the browser timing header, in the RootLayout:
|
This is what worked for me. Relevant dependencies "dependencies": {
"newrelic": "11.5.0",
"next": "13.5.1",
"react": "18.2.0",
"react-dom": "18.2.0",
},
"devDependencies": {
"@types/newrelic": "9.14.3", node: v18.16.0 |
Did anyone face this error?
|
I'm not following what the actual issue is here. I added a PR to officially test an application written in the App Router style. It seems like the request is trying to figure out how to inject the browser agent, which this package doesn't automatically do. I do see this comment explaining how to fix it here. It might also be worth checking out #175 regarding the comment @TomasGonzalez posted. I will keep this open a few more days but we support App Router already with 0 changes |
@kalm42 so you're adding that and what else do you need to do? |
@tclass I think that reference is a way to tell next.js and subsequently webpack to exterrnalize the newrelic module if you are requiring it within your next.js app. This should only be needed if you're trying to get the browser agent via |
This is a duplicate of #173. We have added a test app with app router and shows no issues with instrumentation. We also plan to follow up with better example applications and documentation around injecting browser agent |
Hi there ! |
Is your feature request related to a problem? Please describe.
I'm creating a new Next JS App using the App Folder and I wanted to know if support for it and the Root Layout config already exists. I suppose I would need to add the
beforeTimingHeader
logic directly into thelayout.tsx
file, but when trying implement it and run I receive errors about not having being able to resolve some dependencies while import newrelic. I suppose this may happen because of client vs server side rendering, but I'm not so sure.Feature Description
Support for Next 13s App folder
Describe Alternatives
N/A
Additional context
Here are both my
layout.tsx
file and the error logs I receive when accessing the site locally.Priority
For me this is a
Blocker
since I can't use newrelic with my appThe text was updated successfully, but these errors were encountered: