Agent for Next.js application


  • URL/IP of the SixthSense collector (your tenant URL which will be provided by Customer Support)
  • Access token from the SixthSense portal. For accessing the token, see Accessing your Access Token under Getting started with the Observability Portal.
  • PACKAGE_TOKEN provided by Customer Support.

Downloading the agent

Download the SixthSense agent into your project dependencies "@sixthsense/sixthsense-javascript-agent": "^3.7.2" (Add this dependency to the package.json file of your application).


"dependencies": {
"async": "^1.5.2",
"body-parser": "^1.15.1",
"cookie-parser": "^1.4.3",
"express": "^4.13.4",
"express-session": "^1.13.0",
"finalhandler": "^0.4.1",
"request": "^2.72.0",
"serve-static": "^1.10.2",
"prom-client": "^6.3.0",
"morgan": "^1.7.0",
"connect-redis": "^3.2.0",
"@sixthsense/sixthsense-javascript-agent": "^3.7.2"

Configuring the agent

  • Next.js renders on the server-side. Hence, you must add the following code in one of the application index files.
  • Initialization must occur in the useEffect hook in the application index file.
useEffect(() => {
const Init = async () => {
const ssJS = await import("@sixthsense/sixthsense-javascript-agent");
service: "next-js", // Name the app
collector: '',
pagePath: "index.html",
serviceVersion: "1.2.1",
enableSPA: true,
useFmp: true,
autoTracePerf: true,
enableDirectFetchPatching: false,
detailMode: true,
environment: "testing",
authorization: "Access Token", // Get the Access Token from SixthSense UI
service: "next-js",
collector: '',
serviceVersion: "1.2.1",
perfInterval: 1000,
useFmp: true,
authorization: "Access Token", // Get the Access Token from SixthSense UI
// Call the function to trigger the agent
}, []);