melodic-quill-31019
05/12/2022, 1:23 PMimport { ReactNode, useEffect } from "react";
import { GrowthBook, GrowthBookProvider } from "@growthbook/growthbook-react";
import { useUser } from "src/lib/auth";
import useSWR from "swr";
const growthbook = new GrowthBook();
async function fetcher() {
const res = await fetch(process.env.NEXT_PUBLIC_GROWTHBOOK_FEATURES_ENDPOINT);
if (res.status !== 200) {
return null;
}
const result = await res.json();
return result?.features;
}
export default function MyGrowthBookProvider({
children,
}: {
children: ReactNode;
}) {
const { data: featureFlags } = useSWR("feature-flags", fetcher);
const user = useUser();
useEffect(() => {
growthbook.setFeatures(featureFlags);
}, [featureFlags]);
useEffect(() => {
growthbook.setAttributes({
id: user.data?.id,
});
}, [user.data]);
return (
<GrowthBookProvider growthbook={growthbook}>{children}</GrowthBookProvider>
);
}
<MyGrowthBookProvider />
is used in _app.tsx
(wrapping <Component />
)
The feature flagging works fine, only the dev tool doesn't have any effect.prehistoric-waitress-6977
05/18/2022, 3:18 PMhelpful-hydrogen-62495
05/24/2022, 4:11 PMrefined-city-47392
06/14/2022, 5:58 AMimport { GrowthBook } from "@growthbook/growthbook";
^^^^^^^^^^
SyntaxError: Named export 'GrowthBook' not found. The requested module '@growthbook/growthbook' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from '@growthbook/growthbook';
const { GrowthBook } = pkg;
My IDE (Vscode) has no problem loading the sdk as an ES6 module. No other libs are causing any issues loading them with import. Just to humor node, I tried the suggestion and got the following error:
(node:20837) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
/Users/xxxx/node_modules/@growthbook/growthbook/dist/esm/index.js:1
export { GrowthBook } from "./GrowthBook";
^^^^^^
SyntaxError: Unexpected token 'export'
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1033:15)
at Module._compile (node:internal/modules/cjs/loader:1069:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Module._load (node:internal/modules/cjs/loader:827:12)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:170:29)
at ModuleJob.run (node:internal/modules/esm/module_job:198:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:409:24)
My tsconfig.json is as follows
{
"compilerOptions": {
"target": "ES2022",
"module": "es6",
"lib": [
"ES2022",
"dom"
],
"moduleResolution": "node",
"rootDir": ".",
"outDir": "build",
"allowSyntheticDefaultImports": true,
"importHelpers": true,
"alwaysStrict": true,
"sourceMap": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitAny": false,
"noImplicitThis": false,
"strictNullChecks": false
},
"include": [
"src/**/*",
"__tests__/**/*"
]
}
Versions:
• `node`: 18.3.0
• `@growthbook/growthbook`: 0.18.0
• `tsc`: 4.7.2
Cmd to build is tsc -p tsconfig.json
Cmd to run node build/src/main.js
I spent a good deal of time yesterday trying to figure out the issue but to no avail. Any ideas/suggestions are much appreciated!proud-family-69484
07/07/2022, 3:41 PMrhythmic-furniture-75181
07/18/2022, 3:32 PMhelpful-hydrogen-62495
07/19/2022, 6:39 PMhelpful-hydrogen-62495
08/03/2022, 6:25 PMwitty-pillow-79680
08/23/2022, 5:37 PMplain-butcher-61080
08/31/2022, 6:13 PMrhythmic-psychiatrist-74694
09/04/2022, 5:01 AMwitty-pillow-79680
09/15/2022, 1:11 PMhelpful-carpenter-3208
09/20/2022, 10:53 PMhelpful-hydrogen-62495
10/01/2022, 5:51 PMfull-vase-45670
11/02/2022, 2:21 PMmysterious-iron-16289
11/03/2022, 2:50 PMrhythmic-furniture-75181
11/29/2022, 1:31 PMeager-daybreak-68952
12/19/2022, 8:01 PMfresh-football-47124
helpful-carpenter-3208
02/24/2023, 7:48 PMtoDateTime
to filter the timestamp. And we use the UTC time in the experiment settings. but by default Clickhouse is using the server timezone which is not UTC. so the fix should be add UTC in the toDateTime function like this toDateTime('2023-02-24 17:00:00', 'UTC')
Can anyone help on this?
__experiment as (-- Viewed Experiment
SELECT
e.user_id as user_id,
toString(e.variation_id) as variation,
e.timestamp as timestamp,
e.timestamp as conversion_start,
dateAdd(hour, 720, e.timestamp) as conversion_end
FROM
__rawExperiment e
WHERE
e.experiment_id = 'SOME_EXP_ID'
AND e.timestamp >= toDateTime('2023-02-24 17:00:00')
)
quiet-monkey-7986
03/31/2023, 12:19 PMcuddly-fireman-12522
04/05/2023, 7:32 AMlate-dentist-52023
04/18/2023, 7:16 PMfunction concat(character varying, "unknown", character varying) does not exist
this is in redshift
The issue appears to be this clause:
REGEXP_REPLACE(
MIN(
CONCAT(
cast(e.timestamp as varchar),
'____',
coalesce(cast(e.dimension as varchar), '__NULL_DIMENSION')
)
),
'.*____',
''
) as dimension,
I believe the '____'
also needs to be wrapped in a cast() function
Self-hosting: Build: f58a91e (2023-03-31)best-school-68987
04/18/2023, 11:36 PM<http://consumer-rules.pro|consumer-rules.pro>
bundled with the library, spotted by another user and raised as an issue here. This issue has forced us to downgrade the library.
It seems this repository doesn’t get much traffic - would you accept a contribution to fix this? Happy to fix up this rule, but equally happy to suggest a solution for a GB dev to adoptgreen-engine-21191
04/25/2023, 11:50 AMrelation "staging_react_web.experiment_viewed" does not exist
Full SQL query is added to the thread of this message.
I am currently not sending any events yet to segment. Is there any naming convention I should follow for the events name?salmon-midnight-44452
05/10/2023, 8:47 PMyarn build
. However, it errors with this:
error TS2307: Cannot find module '@growthbook/growthbook' or its corresponding type declarations.
11 } from "@growthbook/growthbook";
~~~~~~~~~~~~~~~~~~~~~~~~
This error appears several times with different files. How do I navigate around this? In node_modules I see @growthbook/growthbook
, so it should be installed properly.some-stone-46275
05/24/2023, 3:35 PM➜ growthbook git:(main) docker-compose up -d
[+] Running 0/1
⠦ growthbook Pulling 3.5s
no matching manifest for linux/arm64/v8 in the manifest list entries
some-stone-46275
05/24/2023, 4:03 PMlate-dentist-52023
05/24/2023, 7:25 PMframework-45b23bd899ce37ec.js:1 TypeError: Cannot read properties of undefined (reading 'name')
at [eid]-548e64021226b7c9.js:1:104923
at Array.map (<anonymous>)
at lt ([eid]-548e64021226b7c9.js:1:104846)
at Eo (framework-45b23bd899ce37ec.js:1:63195)
at xi (framework-45b23bd899ce37ec.js:1:120435)
at bs (framework-45b23bd899ce37ec.js:1:109371)
at gs (framework-45b23bd899ce37ec.js:1:109299)
at vs (framework-45b23bd899ce37ec.js:1:109162)
at as (framework-45b23bd899ce37ec.js:1:105942)
at ls (framework-45b23bd899ce37ec.js:1:104493)
du @ framework-45b23bd899ce37ec.js:1
a.componentDidCatch.t.callback @ framework-45b23bd899ce37ec.js:1
Ua @ framework-45b23bd899ce37ec.js:1
ki @ framework-45b23bd899ce37ec.js:1
bi @ framework-45b23bd899ce37ec.js:1
yi @ framework-45b23bd899ce37ec.js:1
(anonymous) @ framework-45b23bd899ce37ec.js:1
ws @ framework-45b23bd899ce37ec.js:1
ls @ framework-45b23bd899ce37ec.js:1
S @ framework-45b23bd899ce37ec.js:1
T @ framework-45b23bd899ce37ec.js:1
main-99bf36b98c03ec19.js:1 TypeError: Cannot read properties of undefined (reading 'name')
at [eid]-548e64021226b7c9.js:1:104923
at Array.map (<anonymous>)
at lt ([eid]-548e64021226b7c9.js:1:104846)
at Eo (framework-45b23bd899ce37ec.js:1:63195)
at xi (framework-45b23bd899ce37ec.js:1:120435)
at bs (framework-45b23bd899ce37ec.js:1:109371)
at gs (framework-45b23bd899ce37ec.js:1:109299)
at vs (framework-45b23bd899ce37ec.js:1:109162)
at as (framework-45b23bd899ce37ec.js:1:105942)
at ls (framework-45b23bd899ce37ec.js:1:104493)
J
strong-receptionist-58455
06/02/2023, 7:13 AM