-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Improve error message for Graphql API #7805
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This pull request enhances the error message in the AuthUser decorator to provide clearer context about authentication requirements.
- Modified
packages/twenty-server/src/engine/decorators/auth/auth-user.decorator.ts
to improve error clarity - Updated ForbiddenException message to explicitly state that the endpoint requires a user, not just an API key
- Enhanced developer experience by providing more specific authentication requirement information
1 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
@@ -15,7 +15,7 @@ export const AuthUser = createParamDecorator( | |||
const request = getRequest(ctx); | |||
|
|||
if (!options?.allowUndefined && !request.user) { | |||
throw new ForbiddenException("You're not authorized to do this"); | |||
throw new ForbiddenException("You're not authorized to do this. Note: This endpoint requires a user and won't work with just an API key."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider breaking this long string into multiple lines for better readability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea :) Thank you
@thibaultleouay You have lint issues, could you fix those (npx nx run twenty-server:lint:ci to detect them locally) You have created a branch from your main branch so I cannot commit to your branch to help you |
@charlesBochet with gh cli you can do |
I've learned something! |
/award 150 |
Awarding thibaultleouay: 150 points 🕹️ Well done! Check out your new contribution on oss.gg/thibaultleouay |
This improves this error message.