shy-shoe-92329
02/10/2023, 8:57 AMcareful-oyster-228
02/12/2023, 1:40 AMbland-analyst-52463
02/14/2023, 3:20 PMshy-shoe-92329
02/14/2023, 5:39 PMstrong-receptionist-72327
02/15/2023, 6:49 AMechoing-jewelry-24897
02/15/2023, 4:17 PMfeature1
and feature2
) from my cloud hosted GrowthBook app a few days ago but it fails to retrieve them in this morning. No changes have been made. How do I trouble-shoot this issue?echoing-jewelry-24897
02/15/2023, 4:18 PMbland-sugar-5920
02/15/2023, 5:39 PM$experiment_started
events in mixpanel never show up.
I have verified that trackingCallback
in the middleware is being fired so I'm not clear as to
what's happening.
At some point I thought that maybe the middleware was completing before the call to mixpanel
could actually fire so I wrapped the mixpanel.track
into a promise that resolves itself in a
callback passed to mixpanel.track
and then added NextFetchEvent#waitUntil
on the promise in
question. This should have ensured that the middleware waits on the promise to resolve before
moving on but unfortunately this had no discernible effect. I removed this extra complexity sometime
yesterday prior to writing this message so it's not reflected in the pastebin example.
At this point I'm not sure what else to try other than maybe plug in some other library for tracking.
This is my first time using both Growthbook and Vercel middleware so it's totally possible that I'm
doing something naïve. I hope that's really the case!
For context I've included the contents of the middleware in question below. lib/growthbook/features.json
is populated at server start and as part of the build process.
https://paste.laravel.io/4d138b7e-7f96-4ce2-b074-d837ae2d9900brainy-honey-94290
02/15/2023, 6:04 PMpostgres
for the datasource and currently I have only one table (viewed_experiments
), I have not found information regarding the database schema that should be used. thnksmicroscopic-refrigerator-66345
02/16/2023, 9:46 PMmkdir test
cd test
npm init -y
npm install --save @growthbook/growthbook
touch index.js
inside index.js
file, I paste the Step 1 from the guide (https://docs.growthbook.io/lib/js)
import { GrowthBook } from "@growthbook/growthbook";
// Create a GrowthBook instance
const gb = new GrowthBook({
apiHost: "<https://cdn.growthbook.io>",
clientKey: "sdk-key",
// Enable easier debugging of feature flags during development
enableDevMode: true,
});
// Wait for features to be available
await gb.loadFeatures({ autoRefresh: true });
const color = gb.getFeatureValue("button-color");
When I executed node index.js
, the terminal yield
(node:38068) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
./tmp/test/index.js:1
import { GrowthBook } from "@growthbook/growthbook";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Object.compileFunction (node:vm:360:18)
at wrapSafe (node:internal/modules/cjs/loader:1088:15)
at Module._compile (node:internal/modules/cjs/loader:1123:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47
Node.js v18.12.1
Then I add this line to package.json
"type": "module",
And run again the code. This time the error message was this
./tmp/test/index.js:1
import { 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;
at ModuleJob._instantiate (node:internal/modules/esm/module_job:123:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:189:5)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:530:24)
at async loadESM (node:internal/process/esm_loader:91:5)
at async handleMainPromise (node:internal/modules/run_main:65:12)
Node.js v18.12.1
And then, I change the index.js
file to this
import pkg from '@growthbook/growthbook';
const { GrowthBook } = pkg;
// Create a GrowthBook instance
const gb = new GrowthBook({
apiHost: "<https://cdn.growthbook.io>",
clientKey: "sdk-key",
// Enable easier debugging of feature flags during development
enableDevMode: true,
});
// Wait for features to be available
await gb.loadFeatures({ autoRefresh: true });
const color = gb.getFeatureValue("button-color");
And run the nodejs file again. This time I received this error message:
(node:38721) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
./tmp/test/node_modules/@growthbook/growthbook/dist/esm/index.js:1
export { setPolyfills, clearCache, configureCache } from "./feature-repository";
^^^^^^
SyntaxError: Unexpected token 'export'
at Object.compileFunction (node:vm:360:18)
at wrapSafe (node:internal/modules/cjs/loader:1088:15)
at Module._compile (node:internal/modules/cjs/loader:1123:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:169:29)
at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:530:24)
Node.js v18.12.1
Can get any help?cool-apple-97384
02/20/2023, 3:43 AMmelodic-ambulance-10712
02/20/2023, 1:16 PMgreat-lock-96795
02/21/2023, 11:18 PMgb.updateFeatureFlag('feature-flag-key', true);
worried-planet-2191
02/22/2023, 6:39 AMlittle-printer-82939
02/22/2023, 8:31 AMaloof-lighter-92195
02/22/2023, 2:05 PMfreezing-apple-73992
02/23/2023, 5:18 AMincalculable-bear-39658
02/23/2023, 9:05 AMdelightful-daybreak-59517
02/24/2023, 12:46 AMAPI_HOST
or APP_ORIGIN
- yet I’ve tried all kinds of url but had no luck.
Could you help me please? Thanksvictorious-library-28522
02/24/2023, 6:03 AMblue-portugal-81688
02/24/2023, 9:06 AMlocalStorage
polyfill, and to persist the random ID used as id
in the setAttributes
function. We would like the find a solution where the full page cache will only cache the various combinations of Growthbook variations, and not cache for every unique user. Do you have an ideas as to how we can solve this?brainy-honey-94290
02/24/2023, 12:41 PMbright-portugal-19850
02/25/2023, 11:17 AMwonderful-branch-2202
02/28/2023, 5:19 AMmicroscopic-diamond-71089
03/01/2023, 1:53 AMmicroscopic-diamond-71089
03/01/2023, 3:59 AMdamp-printer-48360
03/01/2023, 1:44 PMuser_id
and a `date`: could you explain what the date is for?
I could not find any documentation on it. From the FAQ I understand that this is mostly used to correct/filter experiments and limit them to a subset of user_id
, but I cannot understand the role of the date
column.kind-area-46845
03/01/2023, 2:53 PMfreezing-apple-73992
03/02/2023, 8:03 AMbusy-air-96466
03/02/2023, 4:55 PMversion: "3"
services:
mongo:
image: "mongo:latest"
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=password
growthbook:
platform: linux/amd64
image: "growthbook/growthbook:latest"
ports:
- "4000:3000"
- "4100:3100"
depends_on:
- mongo
environment:
- MONGODB_URI=<mongodb://root:password@mongo:27017/>
- APP_ORIGIN=localhost:4000
- API_HOST=localhost:4100
volumes:
- uploads:/usr/local/src/app/packages/back-end/uploads
volumes:
uploads:
Can anybody see where I’ve gone wrong? I’ve tried http://localhost:4000, http://127.0.0.1:400 for the environment variables but no luck. And I’ve searched the channel but not found this exact issue. Thank you!