Skip to content

Error accessing params and queryparams when browser script injected into NextJs v15 app #1358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
a88zach opened this issue Jan 30, 2025 · 8 comments
Labels
bug Something isn't working in progress

Comments

@a88zach
Copy link

a88zach commented Jan 30, 2025

Description

When using Nextjs v15, errors are thrown with accessing params and query params

Steps to Reproduce

Add newrelic to a NextJs v15 app
Follow this article to inject the browser script https://newrelic.com/blog/how-to-relic/how-to-monitor-app-based-router-nextjs-application
Start the application and click anywhere on the page once loaded

reproduction: https://github.com/a88zach/issue-1358

Expected Behavior

Relevant Logs / Console output

  • Screenshots showing errors

Image

@a88zach a88zach added the bug Something isn't working label Jan 30, 2025
@workato-integration
Copy link

@a88zach
Copy link
Author

a88zach commented Jan 30, 2025

Relevant changes in Next v15: https://nextjs.org/docs/messages/sync-dynamic-apis

@metal-messiah
Copy link
Member

Thanks for sharing this @a88zach . Any chance you have a live replication case we can play with? Is this live on a publicly-accessible site? Otherwise, are you on a version of Next@15 greater than this rc?

@a88zach
Copy link
Author

a88zach commented Jan 30, 2025

I'm on version 15.1.6. I don't have a public reproduction, but I'll put together an example repo and post it here

@jwage
Copy link

jwage commented Jan 31, 2025

This issue may be related symfony/ux#2537

If you have an html element with a property containing an object that has dynamic methods, when you click the element, the element gets passed to newrelic stringify and calls toJSON on the element.__component. In the case of symfony live components, element.__component.toJSON() makes an ajax request and you get an error that the toJSON live action does not exist.

image

@a88zach
Copy link
Author

a88zach commented Jan 31, 2025

@ptang-nr
Copy link
Contributor

ptang-nr commented Feb 21, 2025

Hey @a88zach, I work with Jordan (metal-messiah). I gave the repro repo a go but was unable to reproduce the issue - I rigged up a fresh NodeJS app + Browser app, added a newrelic.js config w/ needed vals, and was able to bring up the test app. I tried clicking on the page, but didn't see any console errors.

I did notice it grabbed nr-spa-1.281.0.min.js. Not sure if that's the difference. Could you check if the issue is still happening and/or if there're other differences or console.log not accounted for in the repro app?

@a88zach
Copy link
Author

a88zach commented Feb 21, 2025

@metal-messiah @ptang-nr I'm going to close this one out. I can no longer reproduce now that v1.281.0 of the client script is used. I couldn't tell in the commit history where this may have been addressed, but regardless, it's no longer throwing the error reported.

@a88zach a88zach closed this as completed Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working in progress
Projects
None yet
Development

No branches or pull requests

4 participants