Hey y'all I'm finding that the lib `@flags-sdk/gro...
# ask-questions
s
Hey y'all I'm finding that the lib
@flags-sdk/growthbook
seems to be unusable in my NextJS App Router application. When I try to implement the adapter with
createGrowthbookAdapter()
and pass in my client key manually I get an error thrown client side. I'm unable to really implement this library at all due to this because this error is thrown even if that var is defined because NextJS does not expose vars to the client without the NEXT_PUBLIC prefix. Seems like a bug that needs to be fixed or is there a way I can fix in my code?
Error:
Copy code
Error: Missing GROWTHBOOK_CLIENT_KEY env var
    at createUnhandledError (webpack-internal:///(app-pages-browser)/../../node_modules/.pnpm/next@15.2.4_@babel+core@7.26.0_@opentelemetry+api@1.9.0_babel-plugin-macros@3.1.0_react_ff0eefa9d84df6ffbb4024f84f17467a/node_modules/next/dist/client/components/errors/console-error.js:27:71)
    at handleClientError (webpack-internal:///(app-pages-browser)/../../node_modules/.pnpm/next@15.2.4_@babel+core@7.26.0_@opentelemetry+api@1.9.0_babel-plugin-macros@3.1.0_react_ff0eefa9d84df6ffbb4024f84f17467a/node_modules/next/dist/client/components/errors/use-error-handler.js:45:56)
    at console.error (webpack-internal:///(app-pages-browser)/../../node_modules/.pnpm/next@15.2.4_@babel+core@7.26.0_@opentelemetry+api@1.9.0_babel-plugin-macros@3.1.0_react_ff0eefa9d84df6ffbb4024f84f17467a/node_modules/next/dist/client/components/globals/intercept-console-error.js:47:56)
    at getOrCreateDefaultGrowthbookAdapter (webpack-internal:///(app-pages-browser)/../../node_modules/.pnpm/@flags-sdk+growthbook@0.1.0_@aws-sdk+credential-provider-web-identity@3.568.0_@aws-sdk+_e76f34a1bd82cff3aba6273b8ad13c16/node_modules/@flags-sdk/growthbook/dist/index.js:115:13)
    at eval (webpack-internal:///(app-pages-browser)/../../node_modules/.pnpm/@flags-sdk+growthbook@0.1.0_@aws-sdk+credential-provider-web-identity@3.568.0_@aws-sdk+_e76f34a1bd82cff3aba6273b8ad13c16/node_modules/@flags-sdk/growthbook/dist/index.js:141:15)
    at (app-pages-browser)/../../node_modules/.pnpm/@flags-sdk+growthbook@0.1.0_@aws-sdk+credential-provider-web-identity@3.568.0_@aws-sdk+_e76f34a1bd82cff3aba6273b8ad13c16/node_modules/@flags-sdk/growthbook/dist/index.js (<http://localhost:3100/_next/static/chunks/app/page.js:29:1>)
I have confirmed that GROWTHBOOK_CLIENT_KEY is not anywhere in my repo and only referenced from within the library.
s
I'm creating a Next project right now w/ Flags, so I'll see if I can replicate.
s
I think I have it working now but the bug I described above would be good to fix so if a user supplies a different ENV var name they can use that even if GROWTHBOOK_CLIENT_KEY is in fact undefined.