Hi, I have started using rudderstack on my next.js...
# support
b
Hi, I have started using rudderstack on my next.js 13 (app router) application. I am using v3.beta.11 and I am initializing it with the following component:
Copy code
'use client';

import { RudderAnalytics } from '@rudderstack/analytics-js';

declare global {
  interface Window {
    rudderanalytics: RudderAnalytics;
  }
}

function rudderInitialize() {
  const rudderStackWriteKey = process.env.NEXT_PUBLIC_RUDDER_WRITE_KEY;
  const rudderStackDataPlaneUrl = process.env.NEXT_PUBLIC_RUDDER_DATA_PLANE_URL;

  const rudderAnalytics = new RudderAnalytics();
  rudderAnalytics.load(rudderStackWriteKey, rudderStackDataPlaneUrl, {});

  window.rudderanalytics = rudderAnalytics;
}

import React from 'react';

export default function RuddeLoader() {
  React.useEffect(() => {
    rudderInitialize();
  }, []);

  return (
    <>
      <div></div>
    </>
  );
}
I get errors in my logs:
Copy code
Import trace for requested module:
./node_modules/.pnpm/@rudderstack+analytics-js@3.0.0-beta.11/node_modules/@rudderstack/analytics-js/dist/npm/modern/esm/index.js
./components/rudderstack/index.tsx

./node_modules/.pnpm/@rudderstack+analytics-js@3.0.0-beta.11/node_modules/@rudderstack/analytics-js/dist/npm/modern/esm/index.js
Critical dependency: the request of a dependency is an expression
and in my console, on the frontend:
Copy code
RS SDK  PluginsManager:: Bugsnag Cannot find module 'https://cdn.rudderlabs.com/beta/3.0.0-beta/modern/plugins/rsa-plugins.js'
RS SDK  PluginsManager:: ErrorReporting Cannot find module 'https://cdn.rudderlabs.com/beta/3.0.0-beta/modern/plugins/rsa-plugins.js'
RS SDK  PluginsManager:: ExternalAnonymousId Cannot find module 'https://cdn.rudderlabs.com/beta/3.0.0-beta/modern/plugins/rsa-plugins.js'
RS SDK  PluginsManager:: GoogleLinker Cannot find module 'https://cdn.rudderlabs.com/beta/3.0.0-beta/modern/plugins/rsa-plugins.js'
RS SDK  PluginsManager:: StorageEncryption Cannot find module 'https://cdn.rudderlabs.com/beta/3.0.0-beta/modern/plugins/rsa-plugins.js'
RS SDK  PluginsManager:: XhrQueue Cannot find module 'https://cdn.rudderlabs.com/beta/3.0.0-beta/modern/plugins/rsa-plugins.js'
Did I do something unexpected?
m
Hey There! 👋 Your message has been received by the RudderStack team. Our standard customer support hours are 9-6 PM EST, but we will forward this request to your Technical Account Manager, and they will get back to you shortly. Please use the thread for any additional comments.
Hi Serpoul, I will pass this error to the team, but this seems to be an issue with the Bugsnag plugin. Can you try removing the Bugsnag plugin from your setup, using this https://www.rudderstack.com/docs/sources/event-streams/sdks/rudderstack-javascript-sdk/v3/#plugins
🙏 1
b
I tried to init with
Copy code
rudderAnalytics.load(rudderStackWriteKey, rudderStackDataPlaneUrl, {
    plugins: []
  });
but same issue 😕
m
Hi serpoul, as this is a Next.JS app the window object is not available and that may cause this problem. This has been solved in the legacy SDK
b
so i should stick to the legacy?
for now?
m
Yes that would be best.
I tried it out and was seeing the same errors. I have raised it to the team as a bug.
🙌 1