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

fix: feature not found in project yields 404 #3958

Merged
merged 2 commits into from
Jun 12, 2023

Conversation

gastonfournier
Copy link
Contributor

About the changes

When a feature is not found in a project we should fail with a NotFound error. If the feature belongs to a different project, it should not be a permission issue, because the user might not be aware (lack of permissions/visibility) of that other project, so even in this case the error should be NotFound (this also works if we ever allow the same feature name in different projects)

Fixes #3726

@vercel
Copy link

vercel bot commented Jun 12, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 12, 2023 10:46am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Jun 12, 2023 10:46am

@@ -11,7 +11,7 @@ export interface IFeatureToggleQuery {
export interface IFeatureToggleStore extends Store<FeatureToggle, string> {
count(query?: Partial<IFeatureToggleQuery>): Promise<number>;
setLastSeen(toggleNames: string[]): Promise<void>;
getProjectId(name: string): Promise<string>;
getProjectId(name: string): Promise<string | undefined>;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a chance that we don't find the project id if the feature does not exist at all

`There's no feature named ${featureName} in project ${projectId} ${
id === undefined
? '.'
: `, but there's a feature by that name in project "${id}"`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we should provide this information in the API, but I'm just keeping the message closer to the one in the left

Copy link
Contributor

@thomasheartman thomasheartman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🙌🏼

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
@gastonfournier gastonfournier merged commit 818b8e7 into main Jun 12, 2023
16 checks passed
@gastonfournier gastonfournier deleted the fix-404-feature-project branch June 12, 2023 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

API returns 403 - Forbidden when toggle does not exist
2 participants