02/15/2023, 5:39 PM
Greetings! I am implementing Growthbook for a/b testing in a next13 environment that deploys to Vercel. Currently the plan is to utilize edge middleware to handle rewrites to variant pages in a fashion similar to the Vercel Optimizely demo repo. The middleware is currently "working" in that based on which group I'm bucketed into I see the correct rendered page content. Unfortunately it's also broken in the sense that my
events in mixpanel never show up. I have verified that
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
into a promise that resolves itself in a callback passed to
and then added
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.
is populated at server start and as part of the build process.