Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to setup with CSR and GitLab instance #44

Closed
sebkasanzew opened this issue Jun 7, 2023 · 5 comments
Closed

Unable to setup with CSR and GitLab instance #44

sebkasanzew opened this issue Jun 7, 2023 · 5 comments
Labels
question Further information is requested

Comments

@sebkasanzew
Copy link

sebkasanzew commented Jun 7, 2023

Describe the bug

The unleash client doesn't get the flag information from the GitLab instance. Although the proxy in /pages/api/feature-flags.tsx returns a JSON with seemingly enough information and a status code 200.

Here is a codesandbox with the reproduces issue:
https://codesandbox.io/p/sandbox/unleash-nextjs-issue-44-35tcdu

You can find:

  • the <FlagProvider /> in /pages/index.tsx
  • useFlag in /components/Features.tsx
  • environment variables in .env

Steps to reproduce the bug

  1. Open this codesandbox: https://codesandbox.io/p/sandbox/unleash-nextjs-issue-44-35tcdu
  2. The text "My feature should be visible" in /components/Features.tsx is not shown

Expected behavior

The feature "my_feature" should be read and handled correctly by the unleash client and the text "My feature should be visible" should be visible.

Logs, error output, etc.

No response

Screenshots

No response

Additional context

Instead of an actual GitLab instance, I mocked the response of the GitLab Unleash instance in /pages/api/feature-flags.tsx which is als present in the real app and is used as a proxy.

Unleash version

GitLab v15.10 (self hosted)

Subscription type

Open source

Hosting type

Self-hosted

SDK information (language and version)

@unleash/nextjs v1.0.0

@sebkasanzew sebkasanzew added the bug Something isn't working label Jun 7, 2023
@pransh15
Copy link

pransh15 commented Jun 8, 2023

Thanks for submitting this, @sebkasanzew. We'll take a look! 👀

@Tymek
Copy link
Member

Tymek commented Jun 8, 2023

Thank you for reporting. I identified an issue. You have data.features instead of data.toggles property in the mocked response.

Correct me if I'm wrong, but I don't think GitLab is supplying Frontend API or Unleash Proxy. You need something in between of GitLab server and your frontend app. That something can be Proxy, Unleash Edge, or Next.js API route resolving toggles.

@Tymek Tymek added question Further information is requested and removed bug Something isn't working labels Jun 8, 2023
@Tymek
Copy link
Member

Tymek commented Jun 15, 2023

Hi @sebkasanzew. Did you manage to fix this? Can I in any other way help explain differences between endpoints? Do you expect that to be in the documentation somewhere?

@sebkasanzew
Copy link
Author

Sorry for the late response, I'm on vacation till the end of June.

I also commented wrongly where the JSON comes from. It's the result of getDefinitions from @unleash/client. So actually I don't know what the exact response from GitLab is.
So pages/api/feature-flags.tsx is already supposed to be my proxy-middleware for the GitLab API.

I'll try to apply your suggestions in July, when I'm fully available again.

@Tymek
Copy link
Member

Tymek commented Jul 4, 2023

@sebkasanzew I'm closing it for now. Please reopen this or tag me in a comment if you encounter any undesired SDK behavior.

@Tymek Tymek closed this as not planned Won't fix, can't repro, duplicate, stale Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
Archived in project
Development

No branches or pull requests

3 participants