Skip to content

The open alternative to Salesforce, designed for AI.

Improve error message for Graphql API (#7805)

Thibault Le Ouay249c7324a2c3
diff --git a/packages/twenty-server/src/engine/decorators/auth/auth-user.decorator.ts b/packages/twenty-server/src/engine/decorators/auth/auth-user.decorator.ts
index 75f3a982e94..35d3ccc08da 100644
--- a/packages/twenty-server/src/engine/decorators/auth/auth-user.decorator.ts
+++ b/packages/twenty-server/src/engine/decorators/auth/auth-user.decorator.ts
@@ -15,7 +15,9 @@ 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.",
+ );
}
return request.user;