Skip to content

fix(api-service): Idempotency cache key user API fixes NV-7060#9845

Merged
scopsy merged 1 commit intonextfrom
cursor/NV-7060-idempotency-cache-key-user-e1e5
Jan 18, 2026
Merged

fix(api-service): Idempotency cache key user API fixes NV-7060#9845
scopsy merged 1 commit intonextfrom
cursor/NV-7060-idempotency-cache-key-user-e1e5

Conversation

@scopsy
Copy link
Contributor

@scopsy scopsy commented Jan 18, 2026

What changed? Why was the change needed?

This PR resolves the InternalServerErrorException: Cannot build idempotency cache key without user (NV-7060, Sentry Issue: API-HM).

The IdempotencyInterceptor.isEnabled() method incorrectly returned true when the authentication scheme was not API_KEY, leading to getCacheKey() being called without a user.

The changes include:

  • Corrected the isEnabled() logic to return false when the auth scheme is not allowed, preventing idempotency from being enabled for non-API_KEY requests.
  • Added defensive checks in both isEnabled() and intercept() methods to gracefully skip idempotency if a user is not present, preventing the InternalServerErrorException.

Linear Issue: NV-7060

Open in Cursor Open in Web

@cursor
Copy link
Contributor

cursor bot commented Jan 18, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@linear
Copy link

linear bot commented Jan 18, 2026

@netlify
Copy link

netlify bot commented Jan 18, 2026

Deploy Preview for dashboard-v2-novu-staging canceled.

Name Link
🔨 Latest commit dcfcf2d
🔍 Latest deploy log https://app.netlify.com/projects/dashboard-v2-novu-staging/deploys/696cad8ac1091a0008bcd65b

@scopsy scopsy changed the title Idempotency cache key user fix(api-service): Idempotency cache key user API fixes NV-7060 Jan 18, 2026
The /v1/widgets/session/initialize endpoint doesn't have authenticated user context,
which causes InternalServerErrorException when idempotency interceptor tries to
build cache key.

Added @ExcludeFromIdempotency() decorator to the sessionInitialize method.

Fixes NV-7060

Co-authored-by: dima <dima@novu.co>
@cursor cursor bot force-pushed the cursor/NV-7060-idempotency-cache-key-user-e1e5 branch from 5753641 to dcfcf2d Compare January 18, 2026 09:53
@scopsy scopsy marked this pull request as ready for review January 18, 2026 09:55
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 18, 2026

Warning

Rate limit exceeded

@scopsy has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 1 minutes and 51 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between fcd5fef and dcfcf2d.

📒 Files selected for processing (1)
  • apps/api/src/app/widgets/widgets.controller.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@scopsy scopsy merged commit 55c6bcc into next Jan 18, 2026
28 checks passed
@scopsy scopsy deleted the cursor/NV-7060-idempotency-cache-key-user-e1e5 branch January 18, 2026 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants