Closed Daniel-Boll closed 1 year ago
I'll try to reproduce it.
@Daniel-Boll what's your Node version? (node -v
).
Also, if you have useFlag
did you try to mark ClientSideCard
component with "use client"
?
@Tymek my node version is v16.19.0. And yes, ClientSideCard is marked as "use client"
I could not reproduce this. My attempt is available here: https://github.com/Tymek/unleash-nextjs-drafts/tree/d8eeb1340dd7da40fe7cafe6ecbe4d611b487d29
Tested on Node v16.20.2, SDK v1.2.0, Next v13.4.17. If you're sure that there is an error in some previous version please let me know. You can also check with explicitly generated API keys.
On my end everything worked out-of-the-box, and I verified that it was on Node v16. Issues like this one should never take place and I'm willing to investigate further.
Thank you, @Tymek, for the prompt response. I will take a look at your suggestion and attempt to try it from scratch once again. If I succeed, I'll be sure to inform you. I'm hopeful that the previous issue was merely a mistake on my part. Thanks once again.
Describe the bug
Problem
I'm integrating Unleash v5.3.0-main in a NextJS 13 project via docker-compose. The objective is to evaluate feature flags both on the server and client sides. However, I'm observing inconsistent results between the two.
Server Side Implementation:
For server side flag evaluation, I'm using the flag function from
@unleash/nextjs
insideapp/page.tsx
. Here's a simplified snippet:Client Side Implementation:
On the client side, I'm using the
FlagProvider
anduseFlag
from@unleash/nextjs/client
insideapp/layout.tsx
and another component respectively:Issues Observed:
Steps to reproduce the bug
docker-compose
.app/page.tsx
, import the necessary modules fromnext/headers
and@unleash/nextjs
.sessionId
.flag
function and log the results.app/layout.tsx
:@unleash/nextjs/client
.sessionId
as in the server side.FlagProvider
component, setting up the configuration as provided in your example.ClientSideCard
), use theuseFlag
hook to fetch the state of the "nextjs-example" flag.unleash-proxy-client@2.5.0
.Expected behavior
Upon integrating Unleash with NextJS 13, both server and client sides should consistently and accurately reflect the current state of the "nextjs-example" feature flag without any errors. Any toggling of the flag in the Unleash dashboard should be immediately and synchronously reflected in both evaluations. No client-side errors related to fetching feature flags should occur.
Logs, error output, etc.
Screenshots
No response
Additional context
Additional Context:
docker-compose
with the version beingv5.3.0-main
.@unleash/nextjs
andunleash-proxy-client@2.5.0
.Understanding if there are known issues, changes in configuration methods, or any updates in the recent
v5.3.0-main
version of Unleash that could lead to such behaviors would be beneficial.Unleash version
Subscription type
Open source
Hosting type
Self-hosted
SDK information (language and version)