is this the right channel for "newbies trying to g...
# ask-questions
b
is this the right channel for "newbies trying to get basic sdk integration instructions to work" style questions? im trying to set up Babys First Feature Flag in a really spaghettified and obscure nextjs app that i inherited, and while im pretty sure this is a "me problem", im wondering if anyone has any clues or leads. from what i can tell from the growthbook in-app instructions, if i want actual client side behavior, i should be following the react instructions not the next instructions. so i am attempting this ๐Ÿงต
f
Sure
Ask away
๐Ÿ‘ 1
b
so i whipped up:
Copy code
'use client';

import { GrowthBook } from '@growthbook/growthbook';
import { GrowthBookProvider } from '@growthbook/growthbook-react';
import { thirdPartyTrackingPlugin, autoAttributesPlugin } from '@growthbook/growthbook/plugins';
import { ReactNode, useEffect } from 'react';

export function GrowthBookInitProvider({ children }: { children: ReactNode }) {
  // DO NOT SHIP THIS - THESE VALUES SHOULD COME FROM ENV
  const growthbook = new GrowthBook({
    apiHost: '<https://cdn.growthbook.io>',
    clientKey: 'sdk-REDACTED',
    enableDevMode: true,
    plugins: [
      // autoAttributesPlugin(),
      thirdPartyTrackingPlugin({ trackers: ['segment'] }),
    ],
  });

  useEffect(() => {
    // Load features asynchronously when the app renders
    growthbook.init({ streaming: true });
  }, []);

  return <GrowthBookProvider growthbook={growthbook}>{children}</GrowthBookProvider>;
}
and i slapped that bad boy into the root layout.tsx
and yet the next.js yarn dev screams at me with a wall of endless:
Copy code
web:build: Error occurred prerendering page "/model/competitors". Read more: <https://nextjs.org/docs/messages/prerender-error>
web:build:
web:build: Error: thirdPartyTrackingPlugin only works in the browser
and i fear that i lack both the general nextjs experience as well as any understanding of whatever convoluted build tooling i have inherited
so the actual question i guess is, what could possibly be causing that failure in the nextjs dev command? i dont even know enough about nextjs to know where to start to look
SOLVED it was *(#$)#ing turborepo doing some (#@)$@(#$ thank you for being my rubberduck @fresh-football-47124 ๐Ÿ˜†
f
Glad I could help
๐Ÿ˜† 1
:)
b
its amazing how sometimes being at the peak of one's despair and just having to explain your problem to someone else, can be so helpful