Skip to content

feat: adds api for password authentication via auth0#2333

Merged
stalniy merged 1 commit intomainfrom
feat/embeded-login-api
Dec 10, 2025
Merged

feat: adds api for password authentication via auth0#2333
stalniy merged 1 commit intomainfrom
feat/embeded-login-api

Conversation

@stalniy
Copy link
Contributor

@stalniy stalniy commented Dec 10, 2025

Why

#2332

Summary by CodeRabbit

  • New Features

    • Password-based login and signup endpoints; option to select an Identity Provider during auth; improved session handling for richer user data.
  • Bug Fixes

    • Reduced notification retry attempts to improve retry behavior.
  • Tests

    • Expanded unit tests covering session management and authentication flows.
  • Chores

    • Updated auth-related build/test configuration and added a small runtime dependency.
  • Style

    • Light theme selector applied to global styles.

✏️ Tip: You can customize this high-level summary in your review settings.

@stalniy stalniy requested a review from a team as a code owner December 10, 2025 04:09
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 10, 2025

Walkthrough

Adds password-based auth endpoints and a SessionService that exchanges tokens with an OAuth provider, provisions/enriches local users, integrates Auth0 session seeding (setSession), renames OAuth signup to loginViaOauth across UI and tests, tunes notification retry attempts, and updates build/test config for @auth0/nextjs-auth0.

Changes

Cohort / File(s) Change Summary
Auth Service API Refactor
apps/deploy-web/src/services/auth/auth/auth.service.ts, apps/deploy-web/src/services/auth/auth/auth.service.spec.ts
Renamed signup()loginViaOauth() (adds optional connection), and added login() and credential signup() methods for password-based flows; tests updated to call loginViaOauth.
UI & Component Updates
apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx, apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx, apps/deploy-web/src/components/onboarding/OnboardingContainer/..., apps/deploy-web/src/components/layout/AccountMenu.tsx, apps/deploy-web/src/hooks/useLoginRequiredEventHandler.tsx
Replaced authService.signup() calls with authService.loginViaOauth(); SignUpButton now uses useMutation for async state; corresponding tests updated.
SessionService & Auth0 Integration
apps/deploy-web/src/services/session/session.service.ts, apps/deploy-web/src/services/session/session.service.spec.ts, apps/deploy-web/src/lib/auth0/setSession/setSession.ts, apps/deploy-web/src/lib/auth0/setSession/setSession.spec.ts
Added SessionService to perform password-realm token exchange, userinfo fetch, create/get local user via console API; added setSession util to seed Auth0 session cache; comprehensive tests added.
Password Auth API Routes
apps/deploy-web/src/pages/api/auth/password-login.ts, apps/deploy-web/src/pages/api/auth/password-signup.ts
New API endpoints with Zod validation implementing password-based login and signup; on success call setSession and return 204; failures return 400 with error payload.
Auth0 Callback / Signup Handler Updates
apps/deploy-web/src/pages/api/auth/[...auth0].ts, apps/deploy-web/src/pages/api/auth/signup.ts
Added connection support from req.query.connection to authorizationParams; replaced manual Axios-based provisioning/fetch with sessionService.createLocalUser() and sessionService.getLocalUserDetails().
DI & Dependency Changes
apps/deploy-web/src/services/app-di-container/server-di-container.service.ts, apps/deploy-web/package.json
Registered sessionService in server DI container and added ts-results runtime dependency.
Build/Test Configuration
apps/deploy-web/jest.config.ts, apps/deploy-web/next.config.js
Added Auth0 module mappings/transformers and server-side aliasing for @auth0/nextjs-auth0; adjusted Jest transform/ignore, test discovery, and Next.js transpilePackages.
Utilities & Styling
apps/deploy-web/src/utils/encoding.ts, packages/ui/styles/global.css
Added fromBase64Url() helper; broadened CSS root selector from :root to :root, .light.
Notification Retry Tuning
apps/api/src/notifications/services/notification/notification.service.ts, apps/api/src/notifications/services/notification/notification.service.spec.ts
Reduced default backoff retry attempts from 10 to 5 and updated tests accordingly.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant Browser as Client
    participant API as /api/auth/password-login
    participant SessionSvc as SessionService
    participant Auth0 as OAuth Provider
    participant ConsoleAPI as Console API (/v1/)
    participant SDK as `@auth0/nextjs-auth0` (SessionCache)

    User->>Browser: submits email & password
    Browser->>API: POST /api/auth/password-login {email,password}
    API->>SessionSvc: signIn({email,password})

    rect rgba(200,220,255,0.35)
      SessionSvc->>Auth0: POST /oauth/token (password realm)
      Auth0-->>SessionSvc: { id_token, access_token, refresh_token }
      SessionSvc->>Auth0: GET /userinfo
      Auth0-->>SessionSvc: user profile
    end

    rect rgba(200,255,220,0.35)
      SessionSvc->>ConsoleAPI: POST /v1/register-user (with access token)
      ConsoleAPI-->>SessionSvc: UserSettings
      SessionSvc->>ConsoleAPI: GET /v1/user/me (enrichment)
      ConsoleAPI-->>SessionSvc: Local user details
    end

    rect rgba(255,235,205,0.35)
      SessionSvc-->>API: merged Session (incl. local settings)
      API->>SDK: setSession(req,res,session)
      SDK-->>API: persisted session/cache
    end

    API-->>Browser: 204 No Content
    Browser-->>User: login success
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

  • Focus review on: SessionService token handling and claim extraction, error/validateStatus branches, security of password flows and Zod schema, correctness and stability of setSession's internal patching of @auth0/nextjs-auth0 SessionCache, and Jest/Next.js aliasing/transformer changes.

Possibly related PRs

Suggested reviewers

  • ygrishajev
  • baktun14

Poem

🐰 A hop, a nibble, tokens bloom—

I patched the cache and cleared the room.
Passwords, OAuth, a local hive,
Sessions stitched so users thrive.
Hop on in — the login's live! 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main objective of the PR, which adds password-based authentication API endpoints using Auth0. The changes include new API routes for password login and signup, SessionService implementation, and supporting infrastructure.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/embeded-login-api

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

@stalniy stalniy force-pushed the feat/embeded-login-api branch from 55510c5 to 9631375 Compare December 10, 2025 04:09
startingDelay: 500,
timeMultiple: 2,
numOfAttempts: 10
numOfAttempts: 5
Copy link
Contributor Author

Choose a reason for hiding this comment

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

reduced it because in case of failure, login request can stuck for about 30+ seconds

@codecov
Copy link

codecov bot commented Dec 10, 2025

Codecov Report

❌ Patch coverage is 55.44041% with 86 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.91%. Comparing base (13c19fa) to head (3047065).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...s/deploy-web/src/pages/api/auth/password-signup.ts 0.00% 30 Missing ⚠️
...deploy-web/src/services/session/session.service.ts 76.84% 22 Missing ⚠️
...ps/deploy-web/src/pages/api/auth/password-login.ts 0.00% 16 Missing ⚠️
apps/deploy-web/src/pages/api/auth/[...auth0].ts 0.00% 7 Missing ⚠️
.../deploy-web/src/lib/auth0/setSession/setSession.ts 82.60% 4 Missing ⚠️
.../deploy-web/src/services/auth/auth/auth.service.ts 33.33% 4 Missing ⚠️
...s/deploy-web/src/components/layout/AccountMenu.tsx 0.00% 1 Missing ⚠️
...loy-web/src/hooks/useLoginRequiredEventHandler.tsx 0.00% 1 Missing ⚠️
apps/deploy-web/src/pages/api/auth/signup.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2333      +/-   ##
==========================================
+ Coverage   50.86%   50.91%   +0.05%     
==========================================
  Files        1045     1049       +4     
  Lines       28533    28699     +166     
  Branches     6279     6333      +54     
==========================================
+ Hits        14513    14613     +100     
- Misses      13706    13824     +118     
+ Partials      314      262      -52     
Flag Coverage Δ
api 81.25% <ø> (-0.03%) ⬇️
deploy-web 30.37% <55.44%> (+0.30%) ⬆️
log-collector 75.35% <ø> (ø)
notifications 87.94% <ø> (ø)
provider-console 81.48% <ø> (ø)
provider-proxy 84.35% <ø> (ø)
Files with missing lines Coverage Δ
...ions/services/notification/notification.service.ts 100.00% <ø> (ø)
.../src/components/auth/SignUpButton/SignUpButton.tsx 100.00% <100.00%> (ø)
...arding/OnboardingContainer/OnboardingContainer.tsx 79.56% <100.00%> (ø)
...es/app-di-container/server-di-container.service.ts 100.00% <100.00%> (+5.00%) ⬆️
apps/deploy-web/src/utils/encoding.ts 86.66% <100.00%> (+13.93%) ⬆️
...s/deploy-web/src/components/layout/AccountMenu.tsx 26.19% <0.00%> (ø)
...loy-web/src/hooks/useLoginRequiredEventHandler.tsx 31.57% <0.00%> (ø)
apps/deploy-web/src/pages/api/auth/signup.ts 0.00% <0.00%> (ø)
.../deploy-web/src/lib/auth0/setSession/setSession.ts 82.60% <82.60%> (ø)
.../deploy-web/src/services/auth/auth/auth.service.ts 88.57% <33.33%> (-11.43%) ⬇️
... and 4 more

... and 56 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@stalniy stalniy force-pushed the feat/embeded-login-api branch from 9631375 to 241978d Compare December 10, 2025 04:23
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
apps/api/src/notifications/services/notification/notification.service.ts (1)

6-11: Address as any casts that violate coding guidelines

The existing as any casts on lines 26 and 48 violate the project's coding guidelines ("Never use type any or cast to type any"). These should be replaced with proper TypeScript types instead of casting the parameters object.

Regarding numOfAttempts: 5: this affects both createNotification and createDefaultChannel call sites. Since both are external API calls and 5 retries is reasonable for these operations, the change is acceptable.

apps/deploy-web/src/pages/api/auth/[...auth0].ts (1)

31-37: isGeneralAxiosError should check error.response?.status instead of error.status

In axios v1.x, the HTTP status code is reliably exposed via error.response?.status, not error.status. The current implementation at line 116–118 checks the latter, which is less reliable.

Update it to:

function isGeneralAxiosError(error: unknown): error is AxiosError {
  return isAxiosError(error) && error.response?.status !== undefined && error.response.status >= 400 && error.response.status < 500;
}

This ensures client errors (400–499) are correctly identified and logged with warning severity, while other errors fall through to the 503 path.

🧹 Nitpick comments (9)
apps/api/src/notifications/services/notification/notification.service.ts (1)

23-27: Avoid as any on request parameters; use concrete types instead

The as any casts on the parameters.header objects effectively disable type checking for these requests and conflict with the “no any” guideline. It would be better to expose proper parameter types from notifications-api.provider (for createNotification and createDefaultChannel) or to introduce narrow local types for the headers and use those here, instead of relying on any.

Also applies to: 45-49

apps/deploy-web/src/pages/api/auth/password-login.ts (1)

1-27: Password-login API handler looks correct; consider minor ergonomics tweaks

The flow (schema validation → sessionService.signInsetSession on success, 400 with error body on failure) is consistent and sound.

Two small optional improvements:

  • Use the validated body from the handler context instead of req.body to fully leverage the zod schema.
  • If desired, tighten password validation (e.g. z.string().min(1)) to reject obviously invalid payloads earlier; Auth0 will still enforce its own rules downstream.
apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx (1)

14-37: Mutation-based signup wiring is solid; consider guarding link clicks when pending

The switch to a useMutation that calls authService.loginViaOauth() is clean and removes custom loading state nicely. Button wiring with disabled={signup.isPending} also looks good.

For the "link" wrapper, you currently set aria-disabled={signup.isPending} but still pass onClick={signup.mutate}, so repeated clicks while the mutation is pending will still trigger additional calls. Consider wrapping the handler to short‑circuit when pending, e.g.:

const handleClick: React.MouseEventHandler = event => {
  if (signup.isPending) {
    event.preventDefault();
    return;
  }
  signup.mutate(event);
};

and use handleClick for both Button and Link.

apps/deploy-web/src/pages/api/auth/password-signup.ts (1)

42-45: Avoid sending a body with a 204 response

res.status(204).json(null); technically violates the 204 “No Content” semantics. It usually works in practice but can confuse some clients or tooling.

Consider either returning 200 with a body or ending the 204 without one:

-      await setSession(req, res, result.val);
-      res.status(204).json(null);
+      await setSession(req, res, result.val);
+      res.status(204).end();
apps/deploy-web/src/services/auth/auth/auth.service.ts (1)

32-45: Password-based login/signup API wrappers are straightforward

login and signup correctly target /api/auth/password-login and /api/auth/password-signup with the expected payloads, keeping the AuthService surface simple and typed.

If you anticipate reusing these input shapes elsewhere, you might later extract them into named interfaces for consistency, but it’s not required right now.

apps/deploy-web/src/services/session/session.service.ts (1)

20-31: Consider resilience when local user APIs fail

Both signIn and signUp assume that /v1/user/me and /v1/register-user succeed; any network/4xx-5xx issues will cause the entire auth flow to fail even when Auth0 credentials are valid.

Depending on your requirements, you might want to:

  • Treat local user API failures as non-fatal (log + return a session without enriched userSettings), or
  • Map them into a distinct error code (e.g., local_user_error) so the UI can differentiate credential issues from local user provisioning issues.

This can be done by wrapping the getLocalUserDetails / createLocalUser calls in try/catch and returning either a downgraded session or a structured Err.

Also applies to: 122-135

apps/deploy-web/src/lib/auth0/setSession/setSession.spec.ts (1)

1-22: Refactor test to use a setup() helper per repo test guidelines

The test is functionally fine, but it doesn’t follow the project’s convention of using a setup helper at the bottom of the root describe block.

You can refactor like this:

 process.env.AUTH0_SECRET ??= "test-secret";
 process.env.AUTH0_CLIENT_ID ??= "test-client-id";
 process.env.AUTH0_CLIENT_SECRET ??= "test-client-secret";

 import { getSession, Session } from "@auth0/nextjs-auth0";
 import { mock } from "jest-mock-extended";
 import type { NextApiRequest, NextApiResponse } from "next";

 import { setSession } from "./setSession";

 describe(setSession.name, () => {
-  it("can set session", async () => {
-    const req = mock<NextApiRequest>();
-    const res = mock<NextApiResponse>();
-    const session = new Session({
-      someClaim: "someValue"
-    });
-    await setSession(req, res, session);
-
-    expect(await getSession(req, res)).toEqual(session);
-  });
+  it("can set session", async () => {
+    const { req, res, session } = setup({});
+
+    await setSession(req, res, session);
+
+    expect(await getSession(req, res)).toEqual(session);
+  });
+
+  function setup({}: { }): {
+    req: NextApiRequest;
+    res: NextApiResponse;
+    session: Session;
+  } {
+    const req = mock<NextApiRequest>();
+    const res = mock<NextApiResponse>();
+    const session = new Session({
+      someClaim: "someValue"
+    });
+
+    return { req, res, session };
+  }
 });

This keeps behavior the same while matching the repo’s testing pattern.

apps/deploy-web/src/pages/api/auth/signup.ts (1)

41-42: Guard req.query.connection before passing it through

The new connection parameter is useful, but req.query.connection can be string | string[]. The cast won’t affect runtime, so an array could still leak through.

Consider narrowing explicitly:

-        authorizationParams: {
+        const connectionParam =
+          typeof req.query.connection === "string" ? req.query.connection : undefined;
+
+        authorizationParams: {
           // Note that this can be combined with prompt=login , which indicates if
@@
-          action: "signup", // <== Classic Universal Login
-          connection: req.query.connection as string | undefined
+          action: "signup", // <== Classic Universal Login
+          connection: connectionParam
         }

This keeps the handler robust even if connection is provided multiple times.

apps/deploy-web/src/services/auth/auth/auth.service.spec.ts (1)

15-33: Tests now exercise loginViaOauth correctly; consider renaming the suite

Switching the calls from signup to loginViaOauth keeps the expectations and behavior intact and matches the new AuthService API.

For clarity, you might also rename the nested suite:

-describe("signup", () => {
+describe("loginViaOauth", () => {

so the description matches the method under test.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 13c19fa and 9631375.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (20)
  • apps/api/src/notifications/services/notification/notification.service.ts (1 hunks)
  • apps/deploy-web/jest.config.ts (3 hunks)
  • apps/deploy-web/next.config.js (3 hunks)
  • apps/deploy-web/package.json (1 hunks)
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx (1 hunks)
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx (2 hunks)
  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx (1 hunks)
  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.tsx (1 hunks)
  • apps/deploy-web/src/lib/auth0/setSession/setSession.spec.ts (1 hunks)
  • apps/deploy-web/src/lib/auth0/setSession/setSession.ts (1 hunks)
  • apps/deploy-web/src/pages/api/auth/[...auth0].ts (4 hunks)
  • apps/deploy-web/src/pages/api/auth/password-login.ts (1 hunks)
  • apps/deploy-web/src/pages/api/auth/password-signup.ts (1 hunks)
  • apps/deploy-web/src/pages/api/auth/signup.ts (1 hunks)
  • apps/deploy-web/src/services/app-di-container/server-di-container.service.ts (2 hunks)
  • apps/deploy-web/src/services/auth/auth/auth.service.spec.ts (2 hunks)
  • apps/deploy-web/src/services/auth/auth/auth.service.ts (2 hunks)
  • apps/deploy-web/src/services/session/session.service.ts (1 hunks)
  • apps/deploy-web/src/utils/encoding.ts (1 hunks)
  • packages/ui/styles/global.css (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

**/*.{ts,tsx,js}: Never use type any or cast to type any. Always define the proper TypeScript types.
Never use deprecated methods from libraries.
Don't add unnecessary comments to the code.

Files:

  • apps/deploy-web/src/lib/auth0/setSession/setSession.spec.ts
  • apps/deploy-web/src/utils/encoding.ts
  • apps/deploy-web/src/services/auth/auth/auth.service.spec.ts
  • apps/deploy-web/src/pages/api/auth/password-login.ts
  • apps/deploy-web/src/lib/auth0/setSession/setSession.ts
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx
  • apps/api/src/notifications/services/notification/notification.service.ts
  • apps/deploy-web/src/pages/api/auth/password-signup.ts
  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
  • apps/deploy-web/jest.config.ts
  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.tsx
  • apps/deploy-web/next.config.js
  • apps/deploy-web/src/pages/api/auth/[...auth0].ts
  • apps/deploy-web/src/services/app-di-container/server-di-container.service.ts
  • apps/deploy-web/src/pages/api/auth/signup.ts
  • apps/deploy-web/src/services/auth/auth/auth.service.ts
  • apps/deploy-web/src/services/session/session.service.ts
**/*.spec.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/no-jest-mock.mdc)

Don't use jest.mock() in test files. Instead, use jest-mock-extended to create mocks and pass mocks as dependencies to the service under test

Use setup function instead of beforeEach in test files. The setup function must be at the bottom of the root describe block, should create an object under test and return it, accept a single parameter with inline type definition, avoid shared state, and not have a specified return type.

**/*.spec.{ts,tsx}: Use <Subject>.name in the root describe suite description instead of hardcoded class/service name strings to enable automated refactoring tools to find all references
Use either a method name or a condition starting with 'when' for nested suite descriptions in tests
Use present simple, 3rd person singular for test descriptions without prepending 'should'

Files:

  • apps/deploy-web/src/lib/auth0/setSession/setSession.spec.ts
  • apps/deploy-web/src/services/auth/auth/auth.service.spec.ts
  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
{apps/deploy-web,apps/provider-console}/**/*.spec.tsx

📄 CodeRabbit inference engine (.cursor/rules/query-by-in-tests.mdc)

Use queryBy methods instead of getBy methods in test expectations

Files:

  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
🧠 Learnings (9)
📚 Learning: 2025-11-25T17:45:52.965Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-11-25T17:45:52.965Z
Learning: Applies to **/*.spec.{ts,tsx} : Use `setup` function instead of `beforeEach` in test files. The `setup` function must be at the bottom of the root `describe` block, should create an object under test and return it, accept a single parameter with inline type definition, avoid shared state, and not have a specified return type.

Applied to files:

  • apps/deploy-web/src/lib/auth0/setSession/setSession.spec.ts
  • apps/deploy-web/src/services/auth/auth/auth.service.spec.ts
  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
  • apps/deploy-web/jest.config.ts
📚 Learning: 2025-11-25T17:45:49.180Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-11-25T17:45:49.180Z
Learning: Applies to {apps/deploy-web,apps/provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations

Applied to files:

  • apps/deploy-web/src/services/auth/auth/auth.service.spec.ts
  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
📚 Learning: 2025-11-25T17:45:44.790Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/no-jest-mock.mdc:0-0
Timestamp: 2025-11-25T17:45:44.790Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use `jest.mock()` in test files. Instead, use `jest-mock-extended` to create mocks and pass mocks as dependencies to the service under test

Applied to files:

  • apps/deploy-web/src/services/auth/auth/auth.service.spec.ts
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
  • apps/deploy-web/jest.config.ts
📚 Learning: 2025-11-25T17:45:58.258Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/test-descriptions.mdc:0-0
Timestamp: 2025-11-25T17:45:58.258Z
Learning: Applies to **/*.spec.{ts,tsx} : Use `<Subject>.name` in the root describe suite description instead of hardcoded class/service name strings to enable automated refactoring tools to find all references

Applied to files:

  • apps/deploy-web/src/services/auth/auth/auth.service.spec.ts
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
📚 Learning: 2025-09-10T08:40:53.104Z
Learnt from: stalniy
Repo: akash-network/console PR: 1892
File: apps/deploy-web/src/components/new-deployment/BidCountdownTimer.tsx:20-31
Timestamp: 2025-09-10T08:40:53.104Z
Learning: In TanStack Query v5, the onSuccess and onError callbacks were removed from useQuery options. Instead, use useEffect with the data as a dependency to handle side effects when query data changes.

Applied to files:

  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx
📚 Learning: 2025-07-11T10:46:43.711Z
Learnt from: stalniy
Repo: akash-network/console PR: 1660
File: apps/deploy-web/src/components/alerts/DeploymentAlertsContainer/DeploymentAlertsContainer.spec.tsx:54-56
Timestamp: 2025-07-11T10:46:43.711Z
Learning: In apps/{deploy-web,provider-console}/**/*.spec.tsx files: Use `getBy` methods instead of `queryBy` methods when testing element presence with `toBeInTheDocument()` because `getBy` throws an error and shows DOM state when element is not found, providing better debugging information than `queryBy` which returns null.

Applied to files:

  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx
📚 Learning: 2025-11-25T17:45:58.258Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/test-descriptions.mdc:0-0
Timestamp: 2025-11-25T17:45:58.258Z
Learning: Applies to **/*.spec.{ts,tsx} : Use either a method name or a condition starting with 'when' for nested suite descriptions in tests

Applied to files:

  • apps/deploy-web/jest.config.ts
📚 Learning: 2025-11-12T16:36:02.543Z
Learnt from: baktun14
Repo: akash-network/console PR: 2203
File: apps/deploy-web/src/components/onboarding/steps/PaymentMethodContainer/PaymentMethodContainer.tsx:161-168
Timestamp: 2025-11-12T16:36:02.543Z
Learning: In apps/deploy-web/src/components/onboarding/steps/PaymentMethodContainer/PaymentMethodContainer.tsx, the organization field captured during payment method setup is internal metadata. Errors from stripe.updateCustomerOrganization should be logged to Sentry but not surfaced to users, and the flow should continue even if the organization update fails, as it's non-critical and not something users can fix.

Applied to files:

  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.tsx
📚 Learning: 2025-08-12T13:52:38.708Z
Learnt from: stalniy
Repo: akash-network/console PR: 1800
File: apps/deploy-web/next.config.js:163-165
Timestamp: 2025-08-12T13:52:38.708Z
Learning: In the Akash Console project, akashnetwork/env-loader is used at the top of next.config.js files to automatically load environment variables from env/.env files into process.env. SENTRY_ORG and SENTRY_PROJECT are stored as public configuration values in apps/deploy-web/env/.env and are loaded this way, while only SENTRY_AUTH_TOKEN is handled as a GitHub secret in workflows.

Applied to files:

  • apps/deploy-web/next.config.js
🧬 Code graph analysis (10)
apps/deploy-web/src/lib/auth0/setSession/setSession.spec.ts (1)
apps/deploy-web/src/lib/auth0/setSession/setSession.ts (1)
  • setSession (47-59)
apps/deploy-web/src/pages/api/auth/password-login.ts (3)
apps/deploy-web/src/lib/nextjs/defineApiHandler/defineApiHandler.ts (1)
  • defineApiHandler (13-53)
apps/deploy-web/src/services/app-di-container/server-di-container.service.ts (1)
  • services (24-50)
apps/deploy-web/src/lib/auth0/setSession/setSession.ts (1)
  • setSession (47-59)
apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx (2)
apps/deploy-web/src/services/auth/auth/auth.service.ts (1)
  • signup (39-45)
packages/ui/components/button.tsx (1)
  • Button (46-46)
apps/deploy-web/src/pages/api/auth/password-signup.ts (2)
apps/deploy-web/src/lib/nextjs/defineApiHandler/defineApiHandler.ts (1)
  • defineApiHandler (13-53)
apps/deploy-web/src/lib/auth0/setSession/setSession.ts (1)
  • setSession (47-59)
apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx (1)
apps/deploy-web/src/services/auth/auth/auth.service.ts (2)
  • AuthService (7-52)
  • signup (39-45)
apps/deploy-web/next.config.js (4)
packages/dev-config/.eslintrc.next.js (1)
  • path (1-1)
packages/dev-config/.eslintrc.ts.js (1)
  • path (1-1)
.eslintrc.js (1)
  • path (1-1)
apps/stats-web/next.config.js (2)
  • require (2-2)
  • require (5-5)
apps/deploy-web/src/pages/api/auth/[...auth0].ts (1)
apps/deploy-web/src/services/app-di-container/server-di-container.service.ts (1)
  • services (24-50)
apps/deploy-web/src/services/app-di-container/server-di-container.service.ts (2)
apps/deploy-web/src/services/app-di-container/browser-di-container.ts (1)
  • services (24-59)
apps/deploy-web/src/services/session/session.service.ts (1)
  • SessionService (9-169)
apps/deploy-web/src/services/auth/auth/auth.service.ts (1)
apps/deploy-web/src/services/session/session.service.ts (1)
  • input (33-90)
apps/deploy-web/src/services/session/session.service.ts (2)
apps/deploy-web/src/types/user.ts (1)
  • UserSettings (5-17)
apps/deploy-web/src/utils/encoding.ts (1)
  • fromBase64Url (23-27)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: test-build
  • GitHub Check: test-build
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
  • GitHub Check: validate / validate-app
  • GitHub Check: validate / validate-app
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (12)
apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx (1)

68-84: Onboarding trial test correctly migrated to loginViaOauth

The expectation on Line 83 now targets authService.loginViaOauth with a returnTo containing /onboarding, which aligns with the updated onboarding flow and AuthService API.

apps/deploy-web/jest.config.ts (1)

2-67: Auth0 Jest wiring looks consistent; verify TS/Jest support for import.meta.url

The added createRequire + path usage and the moduleNameMapper/transform settings for @auth0/nextjs-auth0 (including the dedicated unit-node project) align with the setSession hack and should let Jest resolve and transform Auth0 internals correctly.

One thing to double-check in your environment is that jest.config.ts is executed under a TS/Node configuration that supports import.meta.url (e.g. NodeNext/ESM mode or appropriate transpilation), otherwise createRequire(import.meta.url) could fail at startup.

apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx (1)

48-79: Tests correctly rewire to loginViaOauth while preserving setup helper API

Updating the setup helper to type signup as AuthService["loginViaOauth"] and wiring the mock with { loginViaOauth: signup } keeps existing tests intact while pointing them at the new AuthService method, which is exactly what we want here.

apps/deploy-web/src/services/app-di-container/server-di-container.service.ts (1)

12-49: SessionService DI wiring and dynamic base URLs look correct

The new sessionService registration correctly passes the external HTTP client, a console API client scoped to NEXT_PUBLIC_MANAGED_WALLET_NETWORK_ID, and the Auth0 config values. Updating notificationsApi to derive its base URL from ApiUrlService keeps things network-aware and consistent with other server-side clients.

apps/deploy-web/src/lib/auth0/setSession/setSession.ts (1)

1-59: Auth0 session hack is implemented coherently; guard it with tests against upstream changes

The interception of updateSessionModule.default to capture SessionCache, followed by ensureSessionCacheInitialized + sessionModule.set in setSession, is internally consistent and matches the documented workaround for creating sessions from Auth0 API responses.

Given the reliance on @auth0/nextjs-auth0’s internal modules, the main risk here is library upgrades silently breaking the aliasing or the sessionModule.set contract. The new node-only tests around this helper are important—keep them in place and consider revisiting this file whenever bumping the Auth0 SDK version.

apps/deploy-web/src/pages/api/auth/password-signup.ts (1)

6-35: Password & T&C validation looks good

The password complexity checks and explicit T&C acceptance are clear and match typical security requirements; using Unicode property regexes is a nice touch for internationalization.

apps/deploy-web/src/services/auth/auth/auth.service.ts (1)

15-30: loginViaOauth extension with connection looks correct

Appending connection via URLSearchParams preserves existing behavior and cleanly adds the new capability without altering the redirect flow.

apps/deploy-web/package.json (1)

127-127: ts-results dependency addition looks consistent

Adding ts-results aligns with the Result-based session/service patterns described elsewhere in the PR. No manifest issues from this change alone.

apps/deploy-web/src/utils/encoding.ts (1)

23-27: fromBase64Url implementation is correct and robust

The normalization and padding logic for Base64URL input is sound and safely delegates to the existing fromBase64, covering typical URL-safe token formats.

packages/ui/styles/global.css (1)

6-7: Light theme variables correctly shared between :root and .light

Extending the base variable block to :root, .light is a straightforward way to support class-based light theming without impacting the dark theme block.

apps/deploy-web/next.config.js (1)

12-12: Auth0 transpilation and server-only aliasing look correct; tighten robustness a bit

The additions for:

  • transpilePackages including @auth0/nextjs-auth0, and
  • server-only aliases for @auth0/nextjs-auth0/session and @auth0/nextjs-auth0/update-session

fit well with the new server-side setSession helper and should behave correctly on the server.

Two small follow-ups you might consider:

  1. Defensive resolve initialization

To guard against any future changes to the base webpack config shape:

   webpack: (config, options) => {
@@
-    if (options.isServer) {
+    if (options.isServer) {
+      config.resolve = config.resolve || {};
+      config.resolve.alias = config.resolve.alias || {};
       // see ./src/lib/auth0/setSession/setSession.ts for more details
       config.resolve.alias["@auth0/nextjs-auth0/session"] = path.join(
         require.resolve("@auth0/nextjs-auth0"),
         "..",
         "session",
         "index.js"
       );
       config.resolve.alias["@auth0/nextjs-auth0/update-session"] = path.join(
         require.resolve("@auth0/nextjs-auth0"),
         "..",
         "session",
         "update-session.js"
       );
     }
  1. Fix JSDoc type for options

The second parameter is not a NextConfig; it’s the webpack options context. If you want types there, a looser JSDoc such as @param {{ isServer: boolean }} options (or omitting the type) would be more accurate.

Also applies to: 24-28, 61-80

apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.tsx (1)

159-177: Onboarding start-trial now correctly delegates to loginViaOauth

Routing unauthenticated users through authService.loginViaOauth({ returnTo: ... }) keeps the existing return URL behavior while aligning the onboarding flow with the new AuthService API.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/deploy-web/src/pages/api/auth/signup.ts (1)

44-53: Avoid any in error handling; narrow from unknown instead

The catch (error: any) violates the “no any” guideline and weakens type safety. You can type this as unknown and then narrow based on shape before accessing status/message:

-    } catch (error: any) {
+    } catch (error: unknown) {
       let severity: SeverityLevel = "error";
-      if (error?.status && error.status >= 400 && error.status < 500) {
+      if (typeof error === "object" && error !== null && "status" in error) {
+        const status = (error as { status?: number }).status;
+        if (typeof status === "number" && status >= 400 && status < 500) {
+          severity = "warning";
+          res.status(400).send({ message: (error as { message?: string }).message });
+        } else {
+          res.status(503).send({ message: "An unexpected error occurred. Please try again later." });
+        }
+      } else {
+        res.status(503).send({ message: "An unexpected error occurred. Please try again later." });
+      }
-        severity = "warning";
-        res.status(400).send({ message: error.message });
-      } else {
-        res.status(503).send({ message: "An unexpected error occurred. Please try again later." });
-      }

Adjust the narrowing to match the concrete error type(s) that handleLogin actually throws.

What error types does `handleLogin` from `@auth0/nextjs-auth0` v3.5.0 throw (shape of status/message), and is there a recommended TypeScript type to use instead of `any` in a catch block?
♻️ Duplicate comments (3)
apps/deploy-web/src/pages/api/auth/password-signup.ts (1)

11-13: Fix route metadata to match the password signup endpoint

The handler in password-signup.ts calls sessionService.signUp, but route is set to "/api/auth/password-login". This only affects logging/trace routing but will mislabel this endpoint in Sentry/observability.

Recommend aligning the route string with the actual path:

-export default defineApiHandler({
-  route: "/api/auth/password-login",
+export default defineApiHandler({
+  route: "/api/auth/password-signup",
apps/deploy-web/src/services/session/session.service.ts (2)

108-120: Fix messsage typo so signup errors surface server message

In the non‑invalid_password error path you access signupResponse.data.messsage (three “s”), so you’ll usually ignore the server’s message field and fall back to description or "Signup failed".

Use the correct property name:

-      return Err({
-        message: signupResponse.data.messsage || signupResponse.data.description || "Signup failed",
-        code: "signup_failed"
-      });
+      return Err({
+        message: signupResponse.data.message || signupResponse.data.description || "Signup failed",
+        code: "signup_failed"
+      });

185-191: Harden manual ID token decoding (or prefer Auth0 helpers) to avoid runtime crashes

getClaimsFromToken assumes a well‑formed JWT, base64url payload, and valid JSON. If id_token is missing, malformed, or has a bad payload, token.split(".").at(1) and JSON.parse can throw and take down the request.

At minimum, guard the structure and wrap decode/parse in try/catch:

-function getClaimsFromToken(token: string) {
-  const stringifiedClaims = decoder.decode(fromBase64Url(token.split(".").at(1) || ""));
-  const claims = JSON.parse(stringifiedClaims, (key, value) => {
-    if (IDENTITY_CLAIM_FILTER.has(key)) return undefined;
-    return value;
-  });
-  return claims;
-}
+function getClaimsFromToken(token: string) {
+  const [, payload] = token.split(".");
+  if (!payload) {
+    throw new Error("Invalid ID token format: missing payload");
+  }
+
+  let stringifiedClaims: string;
+  try {
+    stringifiedClaims = decoder.decode(fromBase64Url(payload));
+  } catch {
+    throw new Error("Invalid ID token payload encoding");
+  }
+
+  try {
+    return JSON.parse(stringifiedClaims, (key, value) => {
+      if (IDENTITY_CLAIM_FILTER.has(key)) return undefined;
+      return value;
+    });
+  } catch {
+    throw new Error("Invalid ID token payload JSON");
+  }
+}

Longer‑term, consider using Auth0’s server‑side session helpers or their JWT utilities instead of rolling your own decoder.

What is the recommended way in Auth0 / `@auth0/nextjs-auth0` to obtain ID token claims server-side without manually decoding the JWT string, and does Auth0 provide a helper that can replace `getClaimsFromToken`?
🧹 Nitpick comments (2)
apps/deploy-web/src/lib/auth0/setSession/setSession.ts (1)

31-45: Consider logging initialization failures for debugging.

The empty catch block silences all errors during SDK initialization. While the comment explains this is intentional, logging these errors (at least in development) would aid debugging if the SessionCache capture fails.

   } catch {
     // we only care about triggering the SDK initialization so the SessionCache instance is captured
+    // Errors are expected when no session exists, but logging can help debug unexpected failures
   }

Alternatively, consider logging in development:

  } catch (error) {
    if (process.env.NODE_ENV === 'development') {
      console.debug('Session initialization error (expected if no session):', error);
    }
  }
apps/deploy-web/src/pages/api/auth/password-signup.ts (1)

14-40: Prefer using validated body from handler context instead of req.body

You already validate body with zod via defineApiHandler, but the handler still reads from req.body. Using the validated body makes types tighter and avoids accidentally drifting from the schema.

For example:

-  async handler({ res, req, services }) {
-    const result = await services.sessionService.signUp({
-      email: req.body.email,
-      password: req.body.password
-    });
+  async handler({ res, services, body }) {
+    const result = await services.sessionService.signUp({
+      email: body.email,
+      password: body.password
+    });
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9631375 and 241978d.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (22)
  • apps/api/src/notifications/services/notification/notification.service.ts (1 hunks)
  • apps/deploy-web/jest.config.ts (3 hunks)
  • apps/deploy-web/next.config.js (3 hunks)
  • apps/deploy-web/package.json (1 hunks)
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx (3 hunks)
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx (2 hunks)
  • apps/deploy-web/src/components/layout/AccountMenu.tsx (1 hunks)
  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx (1 hunks)
  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.tsx (1 hunks)
  • apps/deploy-web/src/hooks/useLoginRequiredEventHandler.tsx (1 hunks)
  • apps/deploy-web/src/lib/auth0/setSession/setSession.spec.ts (1 hunks)
  • apps/deploy-web/src/lib/auth0/setSession/setSession.ts (1 hunks)
  • apps/deploy-web/src/pages/api/auth/[...auth0].ts (4 hunks)
  • apps/deploy-web/src/pages/api/auth/password-login.ts (1 hunks)
  • apps/deploy-web/src/pages/api/auth/password-signup.ts (1 hunks)
  • apps/deploy-web/src/pages/api/auth/signup.ts (1 hunks)
  • apps/deploy-web/src/services/app-di-container/server-di-container.service.ts (2 hunks)
  • apps/deploy-web/src/services/auth/auth/auth.service.spec.ts (2 hunks)
  • apps/deploy-web/src/services/auth/auth/auth.service.ts (2 hunks)
  • apps/deploy-web/src/services/session/session.service.ts (1 hunks)
  • apps/deploy-web/src/utils/encoding.ts (1 hunks)
  • packages/ui/styles/global.css (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (10)
  • apps/deploy-web/src/pages/api/auth/password-login.ts
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx
  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.tsx
  • apps/api/src/notifications/services/notification/notification.service.ts
  • apps/deploy-web/src/pages/api/auth/[...auth0].ts
  • apps/deploy-web/src/services/auth/auth/auth.service.spec.ts
  • apps/deploy-web/package.json
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx
  • apps/deploy-web/src/lib/auth0/setSession/setSession.spec.ts
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

**/*.{ts,tsx,js}: Never use type any or cast to type any. Always define the proper TypeScript types.
Never use deprecated methods from libraries.
Don't add unnecessary comments to the code.

Files:

  • apps/deploy-web/src/components/layout/AccountMenu.tsx
  • apps/deploy-web/src/utils/encoding.ts
  • apps/deploy-web/src/pages/api/auth/password-signup.ts
  • apps/deploy-web/src/services/app-di-container/server-di-container.service.ts
  • apps/deploy-web/src/services/session/session.service.ts
  • apps/deploy-web/src/hooks/useLoginRequiredEventHandler.tsx
  • apps/deploy-web/src/lib/auth0/setSession/setSession.ts
  • apps/deploy-web/jest.config.ts
  • apps/deploy-web/next.config.js
  • apps/deploy-web/src/services/auth/auth/auth.service.ts
  • apps/deploy-web/src/pages/api/auth/signup.ts
🧠 Learnings (4)
📚 Learning: 2025-11-25T17:45:44.790Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/no-jest-mock.mdc:0-0
Timestamp: 2025-11-25T17:45:44.790Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use `jest.mock()` in test files. Instead, use `jest-mock-extended` to create mocks and pass mocks as dependencies to the service under test

Applied to files:

  • apps/deploy-web/jest.config.ts
📚 Learning: 2025-11-25T17:45:52.965Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-11-25T17:45:52.965Z
Learning: Applies to **/*.spec.{ts,tsx} : Use `setup` function instead of `beforeEach` in test files. The `setup` function must be at the bottom of the root `describe` block, should create an object under test and return it, accept a single parameter with inline type definition, avoid shared state, and not have a specified return type.

Applied to files:

  • apps/deploy-web/jest.config.ts
📚 Learning: 2025-11-25T17:45:58.258Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/test-descriptions.mdc:0-0
Timestamp: 2025-11-25T17:45:58.258Z
Learning: Applies to **/*.spec.{ts,tsx} : Use either a method name or a condition starting with 'when' for nested suite descriptions in tests

Applied to files:

  • apps/deploy-web/jest.config.ts
📚 Learning: 2025-08-12T13:52:38.708Z
Learnt from: stalniy
Repo: akash-network/console PR: 1800
File: apps/deploy-web/next.config.js:163-165
Timestamp: 2025-08-12T13:52:38.708Z
Learning: In the Akash Console project, akashnetwork/env-loader is used at the top of next.config.js files to automatically load environment variables from env/.env files into process.env. SENTRY_ORG and SENTRY_PROJECT are stored as public configuration values in apps/deploy-web/env/.env and are loaded this way, while only SENTRY_AUTH_TOKEN is handled as a GitHub secret in workflows.

Applied to files:

  • apps/deploy-web/next.config.js
🧬 Code graph analysis (4)
apps/deploy-web/src/pages/api/auth/password-signup.ts (3)
apps/deploy-web/src/lib/nextjs/defineApiHandler/defineApiHandler.ts (1)
  • defineApiHandler (13-53)
apps/deploy-web/src/services/app-di-container/server-di-container.service.ts (1)
  • services (24-50)
apps/deploy-web/src/lib/auth0/setSession/setSession.ts (1)
  • setSession (47-59)
apps/deploy-web/src/services/session/session.service.ts (2)
apps/deploy-web/src/types/user.ts (1)
  • UserSettings (5-17)
apps/deploy-web/src/utils/encoding.ts (1)
  • fromBase64Url (23-27)
apps/deploy-web/jest.config.ts (1)
apps/deploy-web/next.config.js (4)
  • require (5-5)
  • require (11-11)
  • require (15-15)
  • path (12-12)
apps/deploy-web/src/services/auth/auth/auth.service.ts (1)
apps/deploy-web/src/services/session/session.service.ts (1)
  • input (33-90)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
  • GitHub Check: test-build
  • GitHub Check: test-build
  • GitHub Check: test-build
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
  • GitHub Check: Validate local packages
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (14)
packages/ui/styles/global.css (1)

6-6: CSS syntax is correct, but PR scope is unclear.

The selector grouping (:root, .light) is valid CSS and will correctly apply the light theme custom properties to both contexts. However, this file appears disconnected from the PR title about "password authentication via auth0."

Please clarify:

  1. Are there additional files in this PR containing Auth0 API implementation? This CSS file alone only provides theme styling infrastructure.
  2. How is the .light class applied to elements at runtime? (e.g., JavaScript state management, class toggling logic, component props).
  3. What is the relationship between the Auth0 embedded login feature and this theme change? Is the embedded login component expected to operate in light-only mode, or will it respect both light and dark themes?

Without seeing the broader implementation context, I can only confirm the CSS is syntactically correct and follows the existing pattern with the .dark selector.

apps/deploy-web/src/utils/encoding.ts (1)

23-27: LGTM! Clean URL-safe base64 decoder.

The implementation correctly handles the URL-safe base64 alphabet conversion and padding requirements before delegating to the existing fromBase64 function.

apps/deploy-web/next.config.js (1)

12-12: LGTM! Necessary setup for Auth0 internal module access.

Adding the path module and including @auth0/nextjs-auth0 in transpilePackages enables webpack to process and alias Auth0's internal modules for the server-side session workaround.

Also applies to: 24-24

apps/deploy-web/jest.config.ts (2)

2-2: LGTM! Proper Jest setup for Auth0 internal module testing.

The configuration correctly mirrors the webpack aliasing from next.config.js by mapping Auth0's internal modules to their actual file paths in the test environment.

Also applies to: 4-4, 10-10, 15-18


59-67: LGTM! Appropriate transform configuration for Auth0 modules.

The transformIgnorePatterns and custom transformer ensure that @auth0/nextjs-auth0 modules are processed by ts-jest while other node_modules are excluded, enabling proper testing of the session workaround.

apps/deploy-web/src/lib/auth0/setSession/setSession.ts (3)

1-14: LGTM! Excellent documentation of the workaround.

The comprehensive comments clearly explain the problem, the solution approach, and the relationship to the webpack and Jest configurations. This will help future maintainers understand the implementation.


24-29: LGTM! Clever patching approach to capture SessionCache.

The module patching strategy successfully intercepts the internal updateSessionFactory to capture the SessionCache instance needed for session management. While fragile, it's well-documented and necessary given the SDK limitations.


47-59: Verify session persistence across requests.

The setSession implementation correctly delegates to the captured SessionCache. Ensure that sessions created via this workaround persist correctly across subsequent requests and work with Auth0's standard session retrieval.

Test that:

  1. Sessions created by setSession are retrievable via getSession in subsequent requests
  2. Session expiry and refresh token flows work correctly
  3. The session is properly encrypted and stored according to Auth0's security requirements

Based on the test file apps/deploy-web/src/lib/auth0/setSession/setSession.spec.ts mentioned in the AI summary, these scenarios should already be covered, but verify in integration tests as well.

apps/deploy-web/src/services/auth/auth/auth.service.ts (2)

15-30: LGTM! Clear separation between OAuth and password flows.

Renaming signup to loginViaOauth and adding the connection parameter improves API clarity by distinguishing OAuth-based login from password-based authentication. The redirect-based flow is properly maintained.


32-45: LGTM! Clean password authentication methods.

The new login and signup methods provide straightforward password-based authentication by delegating to the appropriate API endpoints. The method signatures are clear and type-safe.

apps/deploy-web/src/hooks/useLoginRequiredEventHandler.tsx (1)

35-35: LGTM! Consistent API usage.

Updated to use the renamed loginViaOauth method, maintaining consistency with the AuthService API changes across the codebase.

apps/deploy-web/src/components/layout/AccountMenu.tsx (1)

111-111: LGTM! Consistent API usage.

Updated to use the renamed loginViaOauth method for the Sign up action, consistent with the AuthService API refactor.

apps/deploy-web/src/services/app-di-container/server-di-container.service.ts (2)

31-32: LGTM! Dynamic base URL improves flexibility.

Replacing the static base URL with a dynamic lookup via apiUrlService.getBaseApiUrlFor() ensures the notifications API uses the correct URL for the current managed wallet network.


35-49: LGTM! Proper SessionService configuration.

The SessionService is correctly instantiated with:

  • External API HTTP client for Auth0 provider calls
  • Console API HTTP client with dynamic base URL for internal API calls
  • Auth0 configuration with all required credentials (issuer, client ID/secret, audience)

The factory pattern ensures proper initialization with all dependencies.

@stalniy stalniy force-pushed the feat/embeded-login-api branch 3 times, most recently from 8e22024 to 8f41d1d Compare December 10, 2025 04:43
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
apps/api/src/notifications/services/notification/notification.service.ts (1)

24-26: Update OpenAPI schema to define x-user-id header parameters, then remove as any casts

The as any casts on parameters bypass type safety and violate the TypeScript guideline to avoid any. However, the root cause is that the OpenAPI specification is incomplete—both createNotification and createDefaultChannel operations are missing the x-user-id header parameter definition in their specs (currently showing "parameters": []), even though the API backend requires this header for authentication.

To properly fix this:

  1. Update the OpenAPI/Swagger spec to include the x-user-id header parameter for both operations in apps/notifications/swagger/swagger.json
  2. Regenerate the TypeScript types from the corrected spec
  3. Remove the as any casts and use the properly typed parameters

This ensures the generated types reflect the actual API requirements and eliminates the need for type casting.

Applies to:

  • Line 24-26: createNotification call
  • Line 46-48: createDefaultChannel call
apps/deploy-web/src/services/auth/auth/auth.service.spec.ts (1)

15-34: Update nested describe name to match the renamed method.

The nested describe block is named "signup" but tests loginViaOauth(). This creates confusion and doesn't follow the guideline of using method names for nested suite descriptions.

-  describe("signup", () => {
-    it("calls signup URL without returnTo parameter", async () => {
+  describe("loginViaOauth", () => {
+    it("calls loginViaOauth URL without returnTo parameter", async () => {
       const { service, httpClient, location } = setup();

       await service.loginViaOauth();

       expect(httpClient.get).toHaveBeenCalledWith(mockSignupUrl, expect.any(Object));
       expect(location.assign).toHaveBeenCalledWith(mockSignupUrl);
     });

-    it("calls signup URL with returnTo parameter", async () => {
+    it("calls loginViaOauth URL with returnTo parameter", async () => {
       const { service, httpClient, location } = setup();
       const returnTo = "/dashboard";

       await service.loginViaOauth({ returnTo });

       expect(httpClient.get).toHaveBeenCalledWith(mockSignupUrl, expect.any(Object));
       expect(location.assign).toHaveBeenCalledWith(`${mockSignupUrl}?returnTo=${encodeURIComponent(returnTo)}`);
     });
   });

Also consider renaming mockSignupUrl to mockLoginUrl or mockOauthUrl for consistency with the renamed method.

♻️ Duplicate comments (1)
apps/deploy-web/next.config.js (1)

74-78: Server-side aliases rely on internal @auth0/nextjs-auth0 module paths.

This has been flagged in a previous review. The aliases to @auth0/nextjs-auth0/session and @auth0/nextjs-auth0/update-session are v3-specific internal paths that will break when upgrading to v4. The previous review provided migration guidance.

🧹 Nitpick comments (5)
apps/deploy-web/src/services/session/session.service.spec.ts (1)

383-388: Consider extracting mock creation into the setup function.

The createHttpClientMock helper is defined outside the describe block. While functional, per coding guidelines, mock creation is typically handled within the setup function using jest-mock-extended. This is already done correctly inside setup, so this external helper is somewhat redundant.

-function createHttpClientMock(): MockProxy<HttpClient> {
-  return mock<HttpClient>({
-    post: jest.fn(),
-    get: jest.fn()
-  } as unknown as HttpClient);
-}
+function createHttpClientMock(): MockProxy<HttpClient> {
+  return mock<HttpClient>();
+}

The explicit jest.fn() assignments are unnecessary since mock<HttpClient>() from jest-mock-extended already provides mock implementations for all methods.

apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx (2)

14-37: Mutation-based wiring around authService.loginViaOauth looks good; consider guarding duplicate clicks on Link

The switch to useMutation<void, Error, React.MouseEvent> with signup.mutate as the click handler is a clean way to centralize the async flow and pending state; signup.isPending correctly drives both the button disabled and link aria-disabled flags.

The only behavioral nit is that the <Link> can still fire click events while marked aria-disabled, which can trigger multiple mutate calls while the mutation is pending. If that matters for your UX, you could wrap signup.mutate with a small handler that early-returns when signup.isPending is true.


7-12: Index signature with any on Props can be tightened later

[key: string]: any; keeps the component flexible but violates the “no any” guideline and weakens type safety for consumers. Not blocking this PR, but it would be good to replace this with a more specific prop shape or a ComponentProps-based helper in a follow-up refactor.

apps/deploy-web/src/lib/auth0/setSession/setSession.ts (1)

1-59: Auth0 SessionCache hook-in is reasonable but brittle; tweak error text

The patching of @auth0/nextjs-auth0/update-session to capture a global SessionCache, then reusing that via sessionModule.set after forcing an SDK init with getSession, is a pragmatic way to implement setSession given the current lack of official support. The flow in ensureSessionCacheInitialized and setSession is coherent for the API-route use case.

Two small points:

  • This will be quite sensitive to @auth0/nextjs-auth0 internals; on SDK upgrades, it’s worth re-running the dedicated setSession tests to ensure the aliasing and patch still work.
  • The thrown error message has a small typo and could be clearer for operators:
-    throw new Error("Cannot create session: SessionCache cache was not automatically discovered");
+    throw new Error("Cannot create session: SessionCache instance was not automatically discovered");
apps/deploy-web/src/pages/api/auth/password-login.ts (1)

1-28: Password-login handler correctly ties sessionService.signIn to setSession; consider 204 semantics

The handler cleanly validates input with Zod, calls sessionService.signIn, and on success establishes the Auth0 session via setSession(req, res, result.val), falling back to a 400 with the error payload when result.ok is false. The control flow is clear and matches the new AuthService.login behavior.

One minor HTTP-detail nit: for a 204 response it’s more conventional to omit a body entirely, e.g.:

-      await setSession(req, res, result.val);
-      res.status(204).json(null);
+      await setSession(req, res, result.val);
+      res.status(204).end();

This is non-blocking if your clients already handle the current behavior.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 241978d and adeffeb.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (23)
  • apps/api/src/notifications/services/notification/notification.service.ts (1 hunks)
  • apps/deploy-web/jest.config.ts (3 hunks)
  • apps/deploy-web/next.config.js (3 hunks)
  • apps/deploy-web/package.json (1 hunks)
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx (3 hunks)
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx (2 hunks)
  • apps/deploy-web/src/components/layout/AccountMenu.tsx (1 hunks)
  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx (1 hunks)
  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.tsx (1 hunks)
  • apps/deploy-web/src/hooks/useLoginRequiredEventHandler.tsx (1 hunks)
  • apps/deploy-web/src/lib/auth0/setSession/setSession.spec.ts (1 hunks)
  • apps/deploy-web/src/lib/auth0/setSession/setSession.ts (1 hunks)
  • apps/deploy-web/src/pages/api/auth/[...auth0].ts (4 hunks)
  • apps/deploy-web/src/pages/api/auth/password-login.ts (1 hunks)
  • apps/deploy-web/src/pages/api/auth/password-signup.ts (1 hunks)
  • apps/deploy-web/src/pages/api/auth/signup.ts (1 hunks)
  • apps/deploy-web/src/services/app-di-container/server-di-container.service.ts (2 hunks)
  • apps/deploy-web/src/services/auth/auth/auth.service.spec.ts (2 hunks)
  • apps/deploy-web/src/services/auth/auth/auth.service.ts (2 hunks)
  • apps/deploy-web/src/services/session/session.service.spec.ts (1 hunks)
  • apps/deploy-web/src/services/session/session.service.ts (1 hunks)
  • apps/deploy-web/src/utils/encoding.ts (1 hunks)
  • packages/ui/styles/global.css (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (11)
  • apps/deploy-web/package.json
  • apps/deploy-web/src/pages/api/auth/password-signup.ts
  • apps/deploy-web/src/hooks/useLoginRequiredEventHandler.tsx
  • apps/deploy-web/src/utils/encoding.ts
  • packages/ui/styles/global.css
  • apps/deploy-web/jest.config.ts
  • apps/deploy-web/src/pages/api/auth/[...auth0].ts
  • apps/deploy-web/src/services/app-di-container/server-di-container.service.ts
  • apps/deploy-web/src/pages/api/auth/signup.ts
  • apps/deploy-web/src/services/session/session.service.ts
  • apps/deploy-web/src/components/layout/AccountMenu.tsx
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

**/*.{ts,tsx,js}: Never use type any or cast to type any. Always define the proper TypeScript types.
Never use deprecated methods from libraries.
Don't add unnecessary comments to the code.

Files:

  • apps/deploy-web/src/services/auth/auth/auth.service.spec.ts
  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx
  • apps/deploy-web/src/services/session/session.service.spec.ts
  • apps/deploy-web/src/lib/auth0/setSession/setSession.ts
  • apps/deploy-web/src/services/auth/auth/auth.service.ts
  • apps/deploy-web/src/lib/auth0/setSession/setSession.spec.ts
  • apps/deploy-web/src/pages/api/auth/password-login.ts
  • apps/deploy-web/next.config.js
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
  • apps/api/src/notifications/services/notification/notification.service.ts
  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.tsx
**/*.spec.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/no-jest-mock.mdc)

Don't use jest.mock() in test files. Instead, use jest-mock-extended to create mocks and pass mocks as dependencies to the service under test

Use setup function instead of beforeEach in test files. The setup function must be at the bottom of the root describe block, should create an object under test and return it, accept a single parameter with inline type definition, avoid shared state, and not have a specified return type.

**/*.spec.{ts,tsx}: Use <Subject>.name in the root describe suite description instead of hardcoded class/service name strings to enable automated refactoring tools to find all references
Use either a method name or a condition starting with 'when' for nested suite descriptions in tests
Use present simple, 3rd person singular for test descriptions without prepending 'should'

Files:

  • apps/deploy-web/src/services/auth/auth/auth.service.spec.ts
  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx
  • apps/deploy-web/src/services/session/session.service.spec.ts
  • apps/deploy-web/src/lib/auth0/setSession/setSession.spec.ts
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
{apps/deploy-web,apps/provider-console}/**/*.spec.tsx

📄 CodeRabbit inference engine (.cursor/rules/query-by-in-tests.mdc)

Use queryBy methods instead of getBy methods in test expectations

Files:

  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
🧠 Learnings (8)
📚 Learning: 2025-11-25T17:45:49.180Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-11-25T17:45:49.180Z
Learning: Applies to {apps/deploy-web,apps/provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations

Applied to files:

  • apps/deploy-web/src/services/auth/auth/auth.service.spec.ts
  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
📚 Learning: 2025-11-25T17:45:52.965Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-11-25T17:45:52.965Z
Learning: Applies to **/*.spec.{ts,tsx} : Use `setup` function instead of `beforeEach` in test files. The `setup` function must be at the bottom of the root `describe` block, should create an object under test and return it, accept a single parameter with inline type definition, avoid shared state, and not have a specified return type.

Applied to files:

  • apps/deploy-web/src/services/auth/auth/auth.service.spec.ts
  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx
  • apps/deploy-web/src/lib/auth0/setSession/setSession.spec.ts
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
📚 Learning: 2025-11-25T17:45:44.790Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/no-jest-mock.mdc:0-0
Timestamp: 2025-11-25T17:45:44.790Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use `jest.mock()` in test files. Instead, use `jest-mock-extended` to create mocks and pass mocks as dependencies to the service under test

Applied to files:

  • apps/deploy-web/src/services/auth/auth/auth.service.spec.ts
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
📚 Learning: 2025-11-25T17:45:58.258Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/test-descriptions.mdc:0-0
Timestamp: 2025-11-25T17:45:58.258Z
Learning: Applies to **/*.spec.{ts,tsx} : Use `<Subject>.name` in the root describe suite description instead of hardcoded class/service name strings to enable automated refactoring tools to find all references

Applied to files:

  • apps/deploy-web/src/services/auth/auth/auth.service.spec.ts
  • apps/deploy-web/src/services/session/session.service.spec.ts
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
📚 Learning: 2025-07-11T10:46:43.711Z
Learnt from: stalniy
Repo: akash-network/console PR: 1660
File: apps/deploy-web/src/components/alerts/DeploymentAlertsContainer/DeploymentAlertsContainer.spec.tsx:54-56
Timestamp: 2025-07-11T10:46:43.711Z
Learning: In apps/{deploy-web,provider-console}/**/*.spec.tsx files: Use `getBy` methods instead of `queryBy` methods when testing element presence with `toBeInTheDocument()` because `getBy` throws an error and shows DOM state when element is not found, providing better debugging information than `queryBy` which returns null.

Applied to files:

  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
📚 Learning: 2025-08-12T13:52:38.708Z
Learnt from: stalniy
Repo: akash-network/console PR: 1800
File: apps/deploy-web/next.config.js:163-165
Timestamp: 2025-08-12T13:52:38.708Z
Learning: In the Akash Console project, akashnetwork/env-loader is used at the top of next.config.js files to automatically load environment variables from env/.env files into process.env. SENTRY_ORG and SENTRY_PROJECT are stored as public configuration values in apps/deploy-web/env/.env and are loaded this way, while only SENTRY_AUTH_TOKEN is handled as a GitHub secret in workflows.

Applied to files:

  • apps/deploy-web/next.config.js
📚 Learning: 2025-09-10T08:40:53.104Z
Learnt from: stalniy
Repo: akash-network/console PR: 1892
File: apps/deploy-web/src/components/new-deployment/BidCountdownTimer.tsx:20-31
Timestamp: 2025-09-10T08:40:53.104Z
Learning: In TanStack Query v5, the onSuccess and onError callbacks were removed from useQuery options. Instead, use useEffect with the data as a dependency to handle side effects when query data changes.

Applied to files:

  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx
📚 Learning: 2025-11-12T16:36:02.543Z
Learnt from: baktun14
Repo: akash-network/console PR: 2203
File: apps/deploy-web/src/components/onboarding/steps/PaymentMethodContainer/PaymentMethodContainer.tsx:161-168
Timestamp: 2025-11-12T16:36:02.543Z
Learning: In apps/deploy-web/src/components/onboarding/steps/PaymentMethodContainer/PaymentMethodContainer.tsx, the organization field captured during payment method setup is internal metadata. Errors from stripe.updateCustomerOrganization should be logged to Sentry but not surfaced to users, and the flow should continue even if the organization update fails, as it's non-critical and not something users can fix.

Applied to files:

  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.tsx
🧬 Code graph analysis (4)
apps/deploy-web/src/services/auth/auth/auth.service.ts (1)
apps/deploy-web/src/services/session/session.service.ts (1)
  • input (33-90)
apps/deploy-web/src/lib/auth0/setSession/setSession.spec.ts (1)
apps/deploy-web/src/lib/auth0/setSession/setSession.ts (1)
  • setSession (47-59)
apps/deploy-web/next.config.js (1)
apps/stats-web/next.config.js (2)
  • require (2-2)
  • require (5-5)
apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx (2)
apps/deploy-web/src/services/auth/auth/auth.service.ts (1)
  • signup (39-45)
packages/ui/components/button.tsx (1)
  • Button (46-46)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
  • GitHub Check: validate (apps/provider-proxy) / validate-unsafe
  • GitHub Check: test-build
  • GitHub Check: test-build
  • GitHub Check: test-build
  • GitHub Check: test-build
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Validate local packages
🔇 Additional comments (14)
apps/api/src/notifications/services/notification/notification.service.ts (1)

6-11: Reduced numOfAttempts to 5: verified as reasonable latency vs reliability tradeoff

With startingDelay: 500, timeMultiple: 2, and maxDelay: 5_000, dropping numOfAttempts from 10 to 5 reduces worst-case wait from ~38–40s to ~13–15s per operation. This shared DEFAULT_BACKOFF_OPTIONS configuration is used in both createNotification (line 38) and createDefaultChannel (line 65), and 5 attempts should be acceptable for transient failures in both flows without requiring separate configurations.

apps/deploy-web/src/lib/auth0/setSession/setSession.spec.ts (1)

1-21: LGTM! Test structure follows coding guidelines.

The test correctly:

  • Uses setSession.name in the describe block for refactoring tool compatibility
  • Uses jest-mock-extended for mocking instead of jest.mock()
  • Sets up Auth0 environment variables before import (required since the library reads them at import time)

One minor observation: the test description "can set session" could be rephrased to present simple 3rd person (e.g., "sets session and retrieves it via getSession"). However, this is a nitpick given the test is clear and functional.

apps/deploy-web/next.config.js (2)

12-12: LGTM on path import addition.

The path module import is correctly added to support the webpack alias configuration.


24-24: LGTM on transpilePackages addition.

Adding @auth0/nextjs-auth0 to transpilePackages ensures proper transpilation of the library for compatibility with the project's build configuration.

apps/deploy-web/src/services/session/session.service.spec.ts (5)

11-11: LGTM! Root describe uses SessionService.name as per coding guidelines.


365-380: LGTM! Setup function follows coding guidelines.

The setup function:

  • Is positioned at the bottom of the root describe block
  • Creates and returns the object under test
  • Accepts a single parameter with inline type definition
  • Avoids shared state
  • Has no explicit return type

12-125: LGTM! signIn tests are comprehensive.

The tests cover:

  • Success path with token exchange, userinfo fetch, and local user enrichment
  • Error path with proper error code mapping
  • API call verification with correct endpoints and headers
  • validateStatus function behavior verification

Test descriptions follow the guideline of using method names for nested describes and present simple 3rd person for test cases.


127-288: LGTM! signUp tests cover key scenarios.

The tests properly validate:

  • Password policy violations returning appropriate error codes
  • Generic signup failures with descriptive error messages
  • Successful signup flow including token exchange and local user creation

290-363: LGTM! createLocalUser and getLocalUserDetails tests are well-structured.

Both tests verify correct API endpoints and authorization headers.

apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.tsx (1)

175-175: LGTM! Method call updated to match renamed auth service API.

The change from authService.signup() to authService.loginViaOauth() aligns with the broader PR refactoring of the authentication service API.

apps/deploy-web/src/services/auth/auth/auth.service.spec.ts (1)

93-112: LGTM! Setup function follows coding guidelines.

The setup function is correctly positioned at the bottom of the root describe block, creates the object under test, accepts a single parameter pattern (none required here), avoids shared state, and has no explicit return type.

apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx (1)

68-84: Onboarding now asserting loginViaOauth with onboarding returnTo – looks consistent

The expectation correctly reflects the switch from signup to loginViaOauth and still verifies that the returnTo URL targets the onboarding path, so the test remains aligned with the updated auth flow.

apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx (1)

48-79: Tests correctly migrated to loginViaOauth and keep type safety

Both tests now validate authService.loginViaOauth being called for link and button variants, and setup’s signup?: AuthService["loginViaOauth"] plus mock<AuthService>({ loginViaOauth: signup }) keeps the wiring type-safe and aligned with the new AuthService API.

apps/deploy-web/src/services/auth/auth/auth.service.ts (1)

15-45: New OAuth + password login/signup methods are wired coherently

Extending loginViaOauth to accept an optional connection parameter and passing it via URLSearchParams keeps the redirect semantics intact while enabling provider selection. The new login and signup methods cleanly delegate to /api/auth/password-login and /api/auth/password-signup with minimal, well-typed payloads and no extra coupling to the underlying session logic.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (3)
apps/deploy-web/src/pages/api/auth/signup.ts (1)

40-48: Normalize connection query param and avoid any in error handling

req.query.connection is string | string[] | undefined, but it’s cast directly to string | undefined and passed to authorizationParams.connection. If a client sends multiple connection values (e.g. ?connection=a&connection=b), an array will be forwarded to Auth0, which expects a single string.

At the same time, catch (error: any) breaks the “no any” guideline and loses type safety when inspecting error.status and error.message.

Consider:

const rawConnection = req.query.connection;
const connection =
  typeof rawConnection === "string"
    ? rawConnection
    : Array.isArray(rawConnection)
    ? rawConnection[0]
    : undefined;

await handleLogin(req, res, {
  returnTo: returnUrl,
  authorizationParams: {
    action: "signup",
    connection
  }
});

And change the catch to use unknown plus narrowing, e.g.:

} catch (error: unknown) {
  let severity: SeverityLevel = "error";

  const status =
    typeof error === "object" && error !== null && "status" in error
      ? (error as { status?: number }).status
      : undefined;

  if (typeof status === "number" && status >= 400 && status < 500) {
    severity = "warning";
    res.status(400).send({ message: (error as { message?: string }).message ?? "Bad request" });
  } else {
    res.status(503).send({ message: "An unexpected error occurred. Please try again later." });
  }

  services.errorHandler.reportError({ severity, error, tags: { category: "auth0", event: "AUTH_SIGNUP_ERROR" } });
}

This keeps behavior the same while guarding against malformed query values and preserving type safety.

What is the type of `req.query` in Next.js API routes, and what type does Auth0’s `authorizationParams.connection` expect in `@auth0/nextjs-auth0`?
apps/deploy-web/next.config.js (1)

12-12: Auth0 internal module aliases are v3-specific; plan for future migration

The server-side webpack aliases for @auth0/nextjs-auth0/session and @auth0/nextjs-auth0/update-session, combined with transpiling @auth0/nextjs-auth0, are necessary for the current setSession workaround, but they hard‑wire the build to v3’s internal module layout. A future upgrade to v4 (or any change in internal paths) will break this configuration.

To avoid surprises when bumping @auth0/nextjs-auth0, keep the dependency pinned to the version whose internals you target and plan a dedicated migration to the public v4 server APIs (session hooks / updateSession replacements) before changing major versions.

This mirrors earlier feedback on the same aliasing approach.

What are the supported public APIs for session creation/update in `@auth0/nextjs-auth0` v3 vs v4, and are the internal paths `@auth0/nextjs-auth0/session` and `@auth0/nextjs-auth0/update-session` considered stable?

Also applies to: 24-24, 61-78

apps/deploy-web/src/services/session/session.service.ts (1)

184-190: Add error handling for malformed JWT tokens.

The getClaimsFromToken function can throw if the token is malformed (missing payload segment, invalid base64, or invalid JSON). Consider adding guards.

 function getClaimsFromToken(token: string) {
-  const stringifiedClaims = decoder.decode(fromBase64Url(token.split(".").at(1) || ""));
-  const claims = JSON.parse(stringifiedClaims, (key, value) => {
-    if (IDENTITY_CLAIM_FILTER.has(key)) return undefined;
-    return value;
-  });
-  return claims;
+  const payload = token.split(".").at(1);
+  if (!payload) {
+    throw new Error("Invalid token: missing payload segment");
+  }
+  try {
+    const stringifiedClaims = decoder.decode(fromBase64Url(payload));
+    const claims = JSON.parse(stringifiedClaims, (key, value) => {
+      if (IDENTITY_CLAIM_FILTER.has(key)) return undefined;
+      return value;
+    });
+    return claims;
+  } catch (error) {
+    throw new Error("Invalid token: failed to decode claims", { cause: error });
+  }
 }
🧹 Nitpick comments (8)
apps/deploy-web/src/utils/encoding.ts (1)

23-27: Implementation is correct.

The Base64 URL decoding logic correctly handles the conversion (replacing - with + and _ with /) and padding calculation. The delegation to fromBase64 promotes code reuse.

Consider verifying whether @cosmjs/encoding or another existing project dependency already provides Base64 URL decoding functionality. While this implementation is correct and concise, leveraging an existing library function would align with the coding guideline to prefer well-known libraries for common operations.

#!/bin/bash
# Check if @cosmjs/encoding exports Base64 URL utilities
rg -n "fromBase64Url|decodeBase64Url" node_modules/@cosmjs/encoding -A 2 -B 2
apps/deploy-web/src/services/app-di-container/server-di-container.service.ts (1)

12-12: Centralize console API HttpClient configuration to avoid duplication

notificationsApi, consoleApiHttpClient, and the SessionService constructor all derive console API clients, and SessionService builds its own axios instance with a base URL instead of reusing consoleApiHttpClient. This risks config drift (interceptors, base URL, timeouts) if one is updated but not the others.

Consider configuring the base URL once in consoleApiHttpClient (using apiUrlService.getBaseApiUrlFor(...)) and passing services.consoleApiHttpClient into SessionService instead of constructing a separate axios instance there.

Also applies to: 31-31, 34-49

apps/deploy-web/src/lib/auth0/setSession/setSession.spec.ts (1)

1-21: End‑to‑end test for setSession is clear and follows local patterns

The test cleanly verifies that setSession wires through to getSession and uses jest-mock-extended plus describe(setSession.name), which matches the repo’s testing conventions. If you ever start using the "direct session" mode (without req/res) in setSession, consider adding a second test for that path; otherwise this looks good as‑is.

apps/deploy-web/src/lib/auth0/setSession/setSession.ts (1)

24-29: Tighten setSession API to avoid ambiguous call patterns

setSession currently overloads behavior via (reqOrSession: NextApiRequest | Session, res: NextApiResponse | undefined, newSession: Session), assuming callers always pass a consistent combination of arguments. Misuse (e.g., passing a Session with a non‑undefined res, or forgetting to pass newSession) won’t be caught at compile time and may behave unexpectedly at runtime.

Consider using TypeScript overloads plus a single implementation to make the API shapes explicit and safer:

export async function setSession(req: NextApiRequest, res: NextApiResponse, session: Session): Promise<void>;
export async function setSession(session: Session): Promise<void>;
export async function setSession(
  reqOrSession: NextApiRequest | Session,
  res?: NextApiResponse,
  newSession?: Session
): Promise<void> {
  const isApiRouteMode = !!res;
  const req = isApiRouteMode ? (reqOrSession as NextApiRequest) : undefined;
  const session = isApiRouteMode ? (newSession as Session) : (reqOrSession as Session);
  // existing logic...
}

This keeps the current behavior but lets the compiler enforce correct call sites and reduces the chance of accidental misuse.

Also applies to: 31-45, 47-58

apps/deploy-web/src/pages/api/auth/password-signup.ts (1)

36-40: Use body from handler context instead of req.body

The defineApiHandler provides a validated and typed body property directly in the handler context. Accessing req.body bypasses this and loses TypeScript type inference.

-  async handler({ res, req, services }) {
+  async handler({ res, req, body, services }) {
     const result = await services.sessionService.signUp({
-      email: req.body.email,
-      password: req.body.password
+      email: body.email,
+      password: body.password
     });
apps/deploy-web/src/services/session/session.service.spec.ts (1)

383-388: Consider simplifying the mock creation.

The mock<HttpClient> already creates a mock with all methods stubbed. The explicit jest.fn() assignments and cast are redundant.

 function createHttpClientMock(): MockProxy<HttpClient> {
-  return mock<HttpClient>({
-    post: jest.fn(),
-    get: jest.fn()
-  } as unknown as HttpClient);
+  return mock<HttpClient>();
 }
apps/deploy-web/src/pages/api/auth/password-login.ts (1)

14-18: Use body from handler context instead of req.body

Same as the signup endpoint, the handler should destructure body from context for type safety and consistency.

-  async handler({ res, req, services }) {
+  async handler({ res, req, body, services }) {
     const result = await services.sessionService.signIn({
-      email: req.body.email,
-      password: req.body.password
+      email: body.email,
+      password: body.password
     });
apps/deploy-web/src/services/session/session.service.ts (1)

140-140: Consider extracting the user metadata namespace as a constant.

The namespace "https://console.akash.network/user_metadata" is used here and also appears in the test file. Extracting it to a shared constant improves maintainability.

+const USER_METADATA_KEY = "https://console.akash.network/user_metadata" as const;
+
 export class SessionService {
   // ...
   async createLocalUser(session: Session): Promise<UserSettings> {
-    const user_metadata = session.user["https://console.akash.network/user_metadata"];
+    const user_metadata = session.user[USER_METADATA_KEY];
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between adeffeb and 8f41d1d.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (23)
  • apps/api/src/notifications/services/notification/notification.service.ts (1 hunks)
  • apps/deploy-web/jest.config.ts (3 hunks)
  • apps/deploy-web/next.config.js (3 hunks)
  • apps/deploy-web/package.json (1 hunks)
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx (3 hunks)
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx (2 hunks)
  • apps/deploy-web/src/components/layout/AccountMenu.tsx (1 hunks)
  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx (1 hunks)
  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.tsx (1 hunks)
  • apps/deploy-web/src/hooks/useLoginRequiredEventHandler.tsx (1 hunks)
  • apps/deploy-web/src/lib/auth0/setSession/setSession.spec.ts (1 hunks)
  • apps/deploy-web/src/lib/auth0/setSession/setSession.ts (1 hunks)
  • apps/deploy-web/src/pages/api/auth/[...auth0].ts (4 hunks)
  • apps/deploy-web/src/pages/api/auth/password-login.ts (1 hunks)
  • apps/deploy-web/src/pages/api/auth/password-signup.ts (1 hunks)
  • apps/deploy-web/src/pages/api/auth/signup.ts (1 hunks)
  • apps/deploy-web/src/services/app-di-container/server-di-container.service.ts (2 hunks)
  • apps/deploy-web/src/services/auth/auth/auth.service.spec.ts (2 hunks)
  • apps/deploy-web/src/services/auth/auth/auth.service.ts (2 hunks)
  • apps/deploy-web/src/services/session/session.service.spec.ts (1 hunks)
  • apps/deploy-web/src/services/session/session.service.ts (1 hunks)
  • apps/deploy-web/src/utils/encoding.ts (1 hunks)
  • packages/ui/styles/global.css (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (8)
  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx
  • apps/api/src/notifications/services/notification/notification.service.ts
  • apps/deploy-web/src/services/auth/auth/auth.service.spec.ts
  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.tsx
  • apps/deploy-web/src/hooks/useLoginRequiredEventHandler.tsx
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
  • packages/ui/styles/global.css
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

**/*.{ts,tsx,js}: Never use type any or cast to type any. Always define the proper TypeScript types.
Never use deprecated methods from libraries.
Don't add unnecessary comments to the code.

Files:

  • apps/deploy-web/src/pages/api/auth/password-signup.ts
  • apps/deploy-web/src/components/layout/AccountMenu.tsx
  • apps/deploy-web/jest.config.ts
  • apps/deploy-web/next.config.js
  • apps/deploy-web/src/services/session/session.service.spec.ts
  • apps/deploy-web/src/utils/encoding.ts
  • apps/deploy-web/src/services/session/session.service.ts
  • apps/deploy-web/src/services/auth/auth/auth.service.ts
  • apps/deploy-web/src/services/app-di-container/server-di-container.service.ts
  • apps/deploy-web/src/pages/api/auth/[...auth0].ts
  • apps/deploy-web/src/pages/api/auth/password-login.ts
  • apps/deploy-web/src/lib/auth0/setSession/setSession.ts
  • apps/deploy-web/src/pages/api/auth/signup.ts
  • apps/deploy-web/src/lib/auth0/setSession/setSession.spec.ts
**/*.spec.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/no-jest-mock.mdc)

Don't use jest.mock() in test files. Instead, use jest-mock-extended to create mocks and pass mocks as dependencies to the service under test

Use setup function instead of beforeEach in test files. The setup function must be at the bottom of the root describe block, should create an object under test and return it, accept a single parameter with inline type definition, avoid shared state, and not have a specified return type.

**/*.spec.{ts,tsx}: Use <Subject>.name in the root describe suite description instead of hardcoded class/service name strings to enable automated refactoring tools to find all references
Use either a method name or a condition starting with 'when' for nested suite descriptions in tests
Use present simple, 3rd person singular for test descriptions without prepending 'should'

Files:

  • apps/deploy-web/src/services/session/session.service.spec.ts
  • apps/deploy-web/src/lib/auth0/setSession/setSession.spec.ts
🧠 Learnings (5)
📚 Learning: 2025-11-25T17:45:44.790Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/no-jest-mock.mdc:0-0
Timestamp: 2025-11-25T17:45:44.790Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use `jest.mock()` in test files. Instead, use `jest-mock-extended` to create mocks and pass mocks as dependencies to the service under test

Applied to files:

  • apps/deploy-web/jest.config.ts
📚 Learning: 2025-11-25T17:45:52.965Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-11-25T17:45:52.965Z
Learning: Applies to **/*.spec.{ts,tsx} : Use `setup` function instead of `beforeEach` in test files. The `setup` function must be at the bottom of the root `describe` block, should create an object under test and return it, accept a single parameter with inline type definition, avoid shared state, and not have a specified return type.

Applied to files:

  • apps/deploy-web/jest.config.ts
  • apps/deploy-web/src/lib/auth0/setSession/setSession.spec.ts
📚 Learning: 2025-11-25T17:45:58.258Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/test-descriptions.mdc:0-0
Timestamp: 2025-11-25T17:45:58.258Z
Learning: Applies to **/*.spec.{ts,tsx} : Use either a method name or a condition starting with 'when' for nested suite descriptions in tests

Applied to files:

  • apps/deploy-web/jest.config.ts
📚 Learning: 2025-08-12T13:52:38.708Z
Learnt from: stalniy
Repo: akash-network/console PR: 1800
File: apps/deploy-web/next.config.js:163-165
Timestamp: 2025-08-12T13:52:38.708Z
Learning: In the Akash Console project, akashnetwork/env-loader is used at the top of next.config.js files to automatically load environment variables from env/.env files into process.env. SENTRY_ORG and SENTRY_PROJECT are stored as public configuration values in apps/deploy-web/env/.env and are loaded this way, while only SENTRY_AUTH_TOKEN is handled as a GitHub secret in workflows.

Applied to files:

  • apps/deploy-web/next.config.js
📚 Learning: 2025-11-25T17:45:58.258Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/test-descriptions.mdc:0-0
Timestamp: 2025-11-25T17:45:58.258Z
Learning: Applies to **/*.spec.{ts,tsx} : Use `<Subject>.name` in the root describe suite description instead of hardcoded class/service name strings to enable automated refactoring tools to find all references

Applied to files:

  • apps/deploy-web/src/services/session/session.service.spec.ts
🧬 Code graph analysis (8)
apps/deploy-web/src/pages/api/auth/password-signup.ts (3)
apps/deploy-web/src/lib/nextjs/defineApiHandler/defineApiHandler.ts (1)
  • defineApiHandler (13-53)
apps/deploy-web/src/services/app-di-container/server-di-container.service.ts (1)
  • services (24-50)
apps/deploy-web/src/lib/auth0/setSession/setSession.ts (1)
  • setSession (47-59)
apps/deploy-web/src/services/session/session.service.spec.ts (2)
apps/deploy-web/src/services/session/session.service.ts (1)
  • OauthConfig (170-175)
apps/deploy-web/src/types/user.ts (1)
  • UserSettings (5-17)
apps/deploy-web/src/services/session/session.service.ts (2)
apps/deploy-web/src/types/user.ts (1)
  • UserSettings (5-17)
apps/deploy-web/src/utils/encoding.ts (1)
  • fromBase64Url (23-27)
apps/deploy-web/src/services/auth/auth/auth.service.ts (1)
apps/deploy-web/src/services/session/session.service.ts (1)
  • input (33-89)
apps/deploy-web/src/services/app-di-container/server-di-container.service.ts (1)
apps/deploy-web/src/services/session/session.service.ts (1)
  • SessionService (9-168)
apps/deploy-web/src/pages/api/auth/[...auth0].ts (1)
apps/deploy-web/src/services/app-di-container/server-di-container.service.ts (1)
  • services (24-50)
apps/deploy-web/src/pages/api/auth/password-login.ts (3)
apps/deploy-web/src/lib/nextjs/defineApiHandler/defineApiHandler.ts (1)
  • defineApiHandler (13-53)
apps/deploy-web/src/services/app-di-container/server-di-container.service.ts (1)
  • services (24-50)
apps/deploy-web/src/lib/auth0/setSession/setSession.ts (1)
  • setSession (47-59)
apps/deploy-web/src/lib/auth0/setSession/setSession.spec.ts (1)
apps/deploy-web/src/lib/auth0/setSession/setSession.ts (1)
  • setSession (47-59)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
  • GitHub Check: validate (apps/provider-proxy) / validate-unsafe
  • GitHub Check: validate (apps/api) / validate-unsafe
  • GitHub Check: validate (apps/provider-console) / validate-unsafe
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
  • GitHub Check: test-build
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
  • GitHub Check: test-build
  • GitHub Check: validate (apps/deploy-web) / should-validate-unsafe / should-validate
  • GitHub Check: test-build
  • GitHub Check: Validate local packages
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (12)
apps/deploy-web/package.json (1)

127-127: ts-results dependency is properly used and secure.

The dependency is actively used in the new SessionService (apps/deploy-web/src/services/session/session.service.ts) for functional error handling with the Result pattern. Version 3.3.0 is the latest stable release with no known security vulnerabilities.

apps/deploy-web/src/components/layout/AccountMenu.tsx (1)

109-114: OAuth signup wiring now correctly targets loginViaOauth

The “Sign up” dropdown entry now calls authService.loginViaOauth(), which aligns with the renamed API and the unified OAuth login/signup flow. No further changes needed here.

apps/deploy-web/src/services/auth/auth/auth.service.ts (1)

15-19: AuthService API surface cleanly separates OAuth and password flows

The updated loginViaOauth with optional connection plus the new login and signup methods for password-based flows form a clear, minimal surface:

  • OAuth login/signup still goes through the /api/auth/signup route with encoded returnTo/connection.
  • Password login/signup go via dedicated JSON POST calls to /api/auth/password-login and /api/auth/password-signup.

The wiring looks consistent with the new backend routes; no changes needed here.

Also applies to: 32-45

apps/deploy-web/src/pages/api/auth/password-signup.ts (1)

6-9: Good use of Unicode property escapes for i18n-friendly password validation.

The regex patterns correctly use Unicode categories (\p{Ll}, \p{Lu}, \p{Nd}) which ensures the password rules work correctly for international characters.

apps/deploy-web/jest.config.ts (2)

40-71: Jest configuration properly separates browser and Node test environments.

The configuration correctly routes lib/auth0 tests to the Node environment while excluding them from jsdom tests. The transform patterns ensure Auth0 library modules are processed correctly.


16-18: Verify the module path resolution for Auth0 subpaths at runtime.

The path construction on lines 17-18 uses require.resolve("@auth0/nextjs-auth0") and navigates up with ".." to reach sibling directories (session/index.js and session/update-session.js). This assumes a specific internal package structure that should be verified when running tests with @auth0/nextjs-auth0@^3.5.0 installed to ensure the computed paths resolve correctly.

apps/deploy-web/src/services/session/session.service.spec.ts (2)

11-11: Good adherence to test naming conventions.

The test file correctly uses SessionService.name in the root describe, which enables automated refactoring tools to find all references. Based on learnings.


365-380: Well-structured setup function following project conventions.

The setup function is correctly positioned at the bottom of the root describe block, accepts a single parameter with inline type definition, avoids shared state, and has no specified return type. Based on learnings.

apps/deploy-web/src/pages/api/auth/password-login.ts (1)

6-27: Endpoint structure looks good.

The login endpoint correctly validates input, delegates to sessionService.signIn, establishes the session on success, and returns appropriate status codes.

apps/deploy-web/src/services/session/session.service.ts (3)

33-89: Well-structured OAuth flow with proper error handling.

The #signInOnProvider method correctly handles the OAuth token exchange, userinfo fetch, and session construction. The use of Result types provides clear success/failure paths.


107-119: Error handling correctly distinguishes password policy violations.

The signup error handling properly differentiates between invalid_password (policy violations) and other signup failures, providing appropriate error codes.


177-179: notServerError helper enables graceful 4xx error handling.

This pattern allows the service to handle client errors (4xx) without throwing, while still failing on server errors (5xx). Good approach for authentication flows where 401/403 responses are expected.

@stalniy stalniy force-pushed the feat/embeded-login-api branch from 8f41d1d to 3047065 Compare December 10, 2025 05:01
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/api/src/notifications/services/notification/notification.service.spec.ts (1)

149-167: Update the test description to match the new retry count.

The test description states "fails after 10 attempts" but the implementation now retries only 5 times.

Apply this diff to fix the inconsistency:

-    it("fails after 10 attempts if notification service is not available and logs an error", async () => {
+    it("fails after 5 attempts if notification service is not available and logs an error", async () => {
♻️ Duplicate comments (3)
apps/deploy-web/src/pages/api/auth/signup.ts (1)

40-44: Guard connection query param and avoid error: any

The issues previously flagged remain unaddressed:

  1. req.query.connection is string | string[] | undefined in Next.js, but Auth0's authorizationParams.connection expects string | undefined. Normalize before use.
  2. catch (error: any) violates the guideline to never use type any.
      authorizationParams: {
        action: "signup",
-       connection: req.query.connection as string | undefined
+       connection: typeof req.query.connection === "string" ? req.query.connection : undefined
      }
    });
-  } catch (error: any) {
+  } catch (error: unknown) {
+    const err = error as { status?: number; message?: string };
     let severity: SeverityLevel = "error";
-    if (error?.status && error.status >= 400 && error.status < 500) {
+    if (err?.status && err.status >= 400 && err.status < 500) {
       severity = "warning";
-      res.status(400).send({ message: error.message });
+      res.status(400).send({ message: err.message });
apps/deploy-web/next.config.js (1)

74-78: Internal module aliasing is fragile and version-sensitive

These aliases resolve to internal, non-public paths within @auth0/nextjs-auth0. While functional for v3.5.0, this approach:

  1. May break on any minor/patch update if Auth0 restructures internal files
  2. Blocks migration to v4.x which removed these internal paths

The inline comment referencing setSession.ts for context is helpful. Consider adding version constraints in package.json (e.g., "@auth0/nextjs-auth0": "~3.5.0") to prevent accidental breakage from updates.

@auth0/nextjs-auth0 latest version December 2025
apps/deploy-web/src/pages/api/auth/[...auth0].ts (1)

36-36: Normalize connection query parameter before use.

The past review comment about normalizing req.query.connection remains valid. In Next.js, req.query values are typed as string | string[] | undefined. Passing an array to Auth0's authorizationParams.connection will cause authentication failures.

🧹 Nitpick comments (3)
apps/deploy-web/src/services/auth/auth/auth.service.spec.ts (1)

15-34: Test suite description references "signup" but calls loginViaOauth

The describe block is named "signup" and tests reference "signup URL", but the method under test is now loginViaOauth(). Consider renaming for clarity:

-  describe("signup", () => {
-    it("calls signup URL without returnTo parameter", async () => {
+  describe("loginViaOauth", () => {
+    it("calls OAuth URL without returnTo parameter", async () => {
       const { service, httpClient, location } = setup();

       await service.loginViaOauth();

-      expect(httpClient.get).toHaveBeenCalledWith(mockSignupUrl, expect.any(Object));
-      expect(location.assign).toHaveBeenCalledWith(mockSignupUrl);
+      expect(httpClient.get).toHaveBeenCalledWith(mockSignupUrl, expect.any(Object));
+      expect(location.assign).toHaveBeenCalledWith(mockSignupUrl);
     });

-    it("calls signup URL with returnTo parameter", async () => {
+    it("calls OAuth URL with returnTo parameter", async () => {
apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx (1)

16-21: Consider moving preventDefault to onClick handlers for cleaner separation.

The mutation receives a React.MouseEvent and calls preventDefault within mutationFn, which couples UI event handling to the mutation logic. A cleaner pattern would handle preventDefault in the onClick handlers and make the mutation independent of browser events.

Consider this alternative:

-  const signup = useMutation<void, Error, React.MouseEvent>({
-    async mutationFn(event) {
-      event.preventDefault();
+  const signup = useMutation({
+    async mutationFn() {
       await authService.loginViaOauth();
     }
   });
+
+  const handleClick = (event: React.MouseEvent) => {
+    event.preventDefault();
+    signup.mutate();
+  };

Then update the button and link:

-        <Button className={className} onClick={signup.mutate} disabled={signup.isPending} {...props}>
+        <Button className={className} onClick={handleClick} disabled={signup.isPending} {...props}>
           {content}
         </Button>

-        <Link href="#" passHref prefetch={false} className={className} onClick={signup.mutate} aria-disabled={signup.isPending} {...props}>
+        <Link href="#" passHref prefetch={false} className={className} onClick={handleClick} aria-disabled={signup.isPending} {...props}>
           {content}
         </Link>
apps/deploy-web/jest.config.ts (1)

15-18: Auth0 moduleNameMapper entries are sound but tightly coupled to package internals

The new mappers for @auth0/nextjs-auth0/session and update-session correctly resolve via require.resolve and path.join, which should make Jest match the runtime aliases used in your Auth0 integration. The trade-off is that these paths are now sensitive to changes in the library’s internal folder structure.

Consider centralizing these Auth0 path assumptions (e.g., a small helper or shared constant used by both next.config and Jest config) so future Auth0 upgrades only need one change. Also verify in CI that @auth0/nextjs-auth0 is always installed where this config runs, since require.resolve will throw otherwise.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8f41d1d and 3047065.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (24)
  • apps/api/src/notifications/services/notification/notification.service.spec.ts (2 hunks)
  • apps/api/src/notifications/services/notification/notification.service.ts (1 hunks)
  • apps/deploy-web/jest.config.ts (3 hunks)
  • apps/deploy-web/next.config.js (3 hunks)
  • apps/deploy-web/package.json (1 hunks)
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx (3 hunks)
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx (2 hunks)
  • apps/deploy-web/src/components/layout/AccountMenu.tsx (1 hunks)
  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx (1 hunks)
  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.tsx (1 hunks)
  • apps/deploy-web/src/hooks/useLoginRequiredEventHandler.tsx (1 hunks)
  • apps/deploy-web/src/lib/auth0/setSession/setSession.spec.ts (1 hunks)
  • apps/deploy-web/src/lib/auth0/setSession/setSession.ts (1 hunks)
  • apps/deploy-web/src/pages/api/auth/[...auth0].ts (4 hunks)
  • apps/deploy-web/src/pages/api/auth/password-login.ts (1 hunks)
  • apps/deploy-web/src/pages/api/auth/password-signup.ts (1 hunks)
  • apps/deploy-web/src/pages/api/auth/signup.ts (1 hunks)
  • apps/deploy-web/src/services/app-di-container/server-di-container.service.ts (2 hunks)
  • apps/deploy-web/src/services/auth/auth/auth.service.spec.ts (2 hunks)
  • apps/deploy-web/src/services/auth/auth/auth.service.ts (2 hunks)
  • apps/deploy-web/src/services/session/session.service.spec.ts (1 hunks)
  • apps/deploy-web/src/services/session/session.service.ts (1 hunks)
  • apps/deploy-web/src/utils/encoding.ts (1 hunks)
  • packages/ui/styles/global.css (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (7)
  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.spec.tsx
  • apps/deploy-web/src/services/session/session.service.spec.ts
  • apps/deploy-web/src/utils/encoding.ts
  • apps/deploy-web/src/components/layout/AccountMenu.tsx
  • apps/deploy-web/src/services/session/session.service.ts
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
  • apps/deploy-web/package.json
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

**/*.{ts,tsx,js}: Never use type any or cast to type any. Always define the proper TypeScript types.
Never use deprecated methods from libraries.
Don't add unnecessary comments to the code.

Files:

  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.tsx
  • apps/deploy-web/src/hooks/useLoginRequiredEventHandler.tsx
  • apps/api/src/notifications/services/notification/notification.service.spec.ts
  • apps/deploy-web/src/pages/api/auth/signup.ts
  • apps/deploy-web/src/services/auth/auth/auth.service.spec.ts
  • apps/deploy-web/src/services/app-di-container/server-di-container.service.ts
  • apps/deploy-web/next.config.js
  • apps/deploy-web/src/pages/api/auth/password-signup.ts
  • apps/deploy-web/src/pages/api/auth/password-login.ts
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx
  • apps/deploy-web/src/services/auth/auth/auth.service.ts
  • apps/deploy-web/src/lib/auth0/setSession/setSession.ts
  • apps/deploy-web/src/pages/api/auth/[...auth0].ts
  • apps/api/src/notifications/services/notification/notification.service.ts
  • apps/deploy-web/src/lib/auth0/setSession/setSession.spec.ts
  • apps/deploy-web/jest.config.ts
**/*.spec.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/no-jest-mock.mdc)

Don't use jest.mock() in test files. Instead, use jest-mock-extended to create mocks and pass mocks as dependencies to the service under test

Use setup function instead of beforeEach in test files. The setup function must be at the bottom of the root describe block, should create an object under test and return it, accept a single parameter with inline type definition, avoid shared state, and not have a specified return type.

**/*.spec.{ts,tsx}: Use <Subject>.name in the root describe suite description instead of hardcoded class/service name strings to enable automated refactoring tools to find all references
Use either a method name or a condition starting with 'when' for nested suite descriptions in tests
Use present simple, 3rd person singular for test descriptions without prepending 'should'

Files:

  • apps/api/src/notifications/services/notification/notification.service.spec.ts
  • apps/deploy-web/src/services/auth/auth/auth.service.spec.ts
  • apps/deploy-web/src/lib/auth0/setSession/setSession.spec.ts
🧠 Learnings (8)
📚 Learning: 2025-11-12T16:36:02.543Z
Learnt from: baktun14
Repo: akash-network/console PR: 2203
File: apps/deploy-web/src/components/onboarding/steps/PaymentMethodContainer/PaymentMethodContainer.tsx:161-168
Timestamp: 2025-11-12T16:36:02.543Z
Learning: In apps/deploy-web/src/components/onboarding/steps/PaymentMethodContainer/PaymentMethodContainer.tsx, the organization field captured during payment method setup is internal metadata. Errors from stripe.updateCustomerOrganization should be logged to Sentry but not surfaced to users, and the flow should continue even if the organization update fails, as it's non-critical and not something users can fix.

Applied to files:

  • apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.tsx
📚 Learning: 2025-11-25T17:45:49.180Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-11-25T17:45:49.180Z
Learning: Applies to {apps/deploy-web,apps/provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations

Applied to files:

  • apps/deploy-web/src/services/auth/auth/auth.service.spec.ts
📚 Learning: 2025-08-12T13:52:38.708Z
Learnt from: stalniy
Repo: akash-network/console PR: 1800
File: apps/deploy-web/next.config.js:163-165
Timestamp: 2025-08-12T13:52:38.708Z
Learning: In the Akash Console project, akashnetwork/env-loader is used at the top of next.config.js files to automatically load environment variables from env/.env files into process.env. SENTRY_ORG and SENTRY_PROJECT are stored as public configuration values in apps/deploy-web/env/.env and are loaded this way, while only SENTRY_AUTH_TOKEN is handled as a GitHub secret in workflows.

Applied to files:

  • apps/deploy-web/next.config.js
📚 Learning: 2025-09-10T08:40:53.104Z
Learnt from: stalniy
Repo: akash-network/console PR: 1892
File: apps/deploy-web/src/components/new-deployment/BidCountdownTimer.tsx:20-31
Timestamp: 2025-09-10T08:40:53.104Z
Learning: In TanStack Query v5, the onSuccess and onError callbacks were removed from useQuery options. Instead, use useEffect with the data as a dependency to handle side effects when query data changes.

Applied to files:

  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx
📚 Learning: 2025-11-25T17:45:52.965Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-11-25T17:45:52.965Z
Learning: Applies to **/*.spec.{ts,tsx} : Use `setup` function instead of `beforeEach` in test files. The `setup` function must be at the bottom of the root `describe` block, should create an object under test and return it, accept a single parameter with inline type definition, avoid shared state, and not have a specified return type.

Applied to files:

  • apps/deploy-web/src/lib/auth0/setSession/setSession.spec.ts
  • apps/deploy-web/jest.config.ts
📚 Learning: 2025-11-25T17:45:44.790Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/no-jest-mock.mdc:0-0
Timestamp: 2025-11-25T17:45:44.790Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use `jest.mock()` in test files. Instead, use `jest-mock-extended` to create mocks and pass mocks as dependencies to the service under test

Applied to files:

  • apps/deploy-web/jest.config.ts
📚 Learning: 2025-11-25T17:45:39.561Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-25T17:45:39.561Z
Learning: Applies to **/*.{ts,tsx,js} : Don't add unnecessary comments to the code.

Applied to files:

  • apps/deploy-web/jest.config.ts
📚 Learning: 2025-11-25T17:45:58.258Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/test-descriptions.mdc:0-0
Timestamp: 2025-11-25T17:45:58.258Z
Learning: Applies to **/*.spec.{ts,tsx} : Use either a method name or a condition starting with 'when' for nested suite descriptions in tests

Applied to files:

  • apps/deploy-web/jest.config.ts
🧬 Code graph analysis (6)
apps/deploy-web/src/pages/api/auth/password-signup.ts (3)
apps/deploy-web/src/lib/nextjs/defineApiHandler/defineApiHandler.ts (1)
  • defineApiHandler (13-53)
apps/deploy-web/src/services/app-di-container/server-di-container.service.ts (1)
  • services (24-50)
apps/deploy-web/src/lib/auth0/setSession/setSession.ts (1)
  • setSession (47-59)
apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx (2)
apps/deploy-web/src/services/auth/auth/auth.service.ts (1)
  • signup (39-45)
packages/ui/components/button.tsx (1)
  • Button (46-46)
apps/deploy-web/src/services/auth/auth/auth.service.ts (1)
apps/deploy-web/src/services/session/session.service.ts (1)
  • input (33-89)
apps/deploy-web/src/pages/api/auth/[...auth0].ts (2)
apps/deploy-web/src/services/app-di-container/server-di-container.service.ts (1)
  • services (24-50)
apps/deploy-web/src/services/app-di-container/browser-di-container.ts (1)
  • services (24-59)
apps/deploy-web/src/lib/auth0/setSession/setSession.spec.ts (3)
apps/deploy-web/src/lib/auth0/setSession/setSession.ts (1)
  • setSession (47-59)
apps/notifications/script/init-db.js (1)
  • res (24-24)
apps/deploy-web/tests/ui/fixture/context-with-extension.ts (1)
  • expect (78-78)
apps/deploy-web/jest.config.ts (2)
apps/deploy-web/next.config.js (4)
  • require (5-5)
  • require (11-11)
  • require (15-15)
  • path (12-12)
packages/logging/src/config/index.ts (1)
  • Config (7-7)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
  • GitHub Check: validate (apps/log-collector) / validate-unsafe
  • GitHub Check: validate (packages) / validate-unsafe
  • GitHub Check: validate (apps/provider-console) / validate-unsafe
  • GitHub Check: test-build
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
  • GitHub Check: test-build
  • GitHub Check: test-build
  • GitHub Check: test-build
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
  • GitHub Check: Validate local packages
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (15)
packages/ui/styles/global.css (1)

6-6: The .light class selector is not currently used in the codebase.

The theme system checks for the presence of the "dark" class on the document element (classList.contains("dark")), with light mode being the default state when this class is absent. Adding :root, .light { to the CSS assumes that the application applies a class="light" attribute somewhere, but no such usage exists in the code. The selector will have no effect.

Likely an incorrect or invalid review comment.

apps/api/src/notifications/services/notification/notification.service.spec.ts (1)

146-146: LGTM!

The updated expectation correctly reflects the reduced retry count in the implementation.

apps/api/src/notifications/services/notification/notification.service.ts (1)

10-10: LGTM!

The reduced retry count improves user experience by preventing prolonged hangs during authentication failures. The trade-off between failure speed and resilience is appropriate for login flows.

apps/deploy-web/src/hooks/useLoginRequiredEventHandler.tsx (1)

34-36: LGTM!

The update to use loginViaOauth() aligns with the API rename across the codebase. The authService dependency is correctly included in the callback's closure via the outer useCallback.

apps/deploy-web/src/components/onboarding/OnboardingContainer/OnboardingContainer.tsx (1)

174-177: LGTM!

The migration from signup to loginViaOauth is consistent with the broader API refactor. The returnTo URL construction correctly preserves the origin and onboarding path, and authService is properly listed in the dependency array.

apps/deploy-web/src/services/app-di-container/server-di-container.service.ts (2)

35-49: LGTM!

The SessionService is properly wired with:

  • externalApiHttpClient for OAuth provider calls
  • A dedicated console API client with interceptors applied
  • Auth0 configuration including secrets (appropriate for server-side)

The separation between externalApiHttpClient and the console-specific client is a clean design for different API targets.


31-31: Dynamic base URL resolution is an improvement

Switching from a potentially hardcoded URL to apiUrlService.getBaseApiUrlFor() centralizes URL management and supports multi-network configurations.

apps/deploy-web/src/pages/api/auth/password-signup.ts (2)

6-9: LGTM! Unicode property escapes provide robust international character support.

The password validation regex patterns use Unicode property escapes (\p{Ll}, \p{Lu}, \p{Nd}) which correctly handle international characters beyond ASCII. This is a best practice for global applications.


36-49: Password signup flow is correctly implemented.

The handler properly validates input, calls the session service, sets the session on success, and returns appropriate HTTP status codes (204 for success, 400 for client errors).

apps/deploy-web/src/pages/api/auth/password-login.ts (1)

6-28: LGTM! Password login implementation follows consistent patterns.

The handler correctly validates credentials, calls the session service, and handles success/error cases with appropriate HTTP status codes. The implementation is consistent with the password-signup endpoint.

apps/deploy-web/src/lib/auth0/setSession/setSession.ts (1)

1-14: Acknowledged workaround with clear documentation.

The comprehensive comments clearly explain this is a temporary solution until Auth0 officially supports session creation from API responses. The documented approach (webpack aliases, Jest config, module patching) provides maintainability context for future developers.

apps/deploy-web/src/services/auth/auth/auth.service.ts (2)

15-30: LGTM! OAuth login method properly supports connection parameter.

The renamed loginViaOauth method correctly adds the optional connection parameter to query params when provided, maintaining backward compatibility with existing callers.


32-45: Password authentication methods are correctly implemented.

Both login and signup methods properly POST credentials to their respective API endpoints. The signup method correctly includes the termsAndConditions field for compliance validation.

apps/deploy-web/jest.config.ts (2)

2-4: ESM-friendly require usage looks correct

Using createRequire(import.meta.url) plus a typed require.resolve for path discovery is an appropriate way to keep this Jest config in ESM/TS while still leveraging Node resolution. No issues here.

If you haven’t already, please run the Jest suite once from a clean checkout to confirm the config file loads correctly under your current Node/Jest TS loader setup.

Also applies to: 10-10


30-30: Multi-project Jest config and Auth0 transforms look consistent

  • Excluding /lib/nextjs/ and /lib/auth0/ from the jsdom project and then explicitly targeting src/lib/{nextjs,auth0} in the unit-node project keeps responsibilities clear between browser- and node-focused tests.
  • Adding /lib/auth0/ to coveragePathIgnorePatterns for the unit project plus the more granular ignore rules for unit-node looks deliberate and consistent.
  • The unit-node transformIgnorePatterns and extra transform entry for @auth0/nextjs-auth0/...\.js using ts-jest with tsconfig.build.json is a reasonable way to selectively transpile that ESM dependency without touching the rest of node_modules.

Overall this block hangs together and respects the existing common config.

Please confirm that:

  • Node tests under src/lib/{nextjs,auth0} are discovered with this testMatch glob on your platform, and
  • tsconfig.build.json is compatible with transforming the @auth0/nextjs-auth0 JavaScript files (e.g., allowJs or equivalent where needed).

Also applies to: 46-46, 54-67

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments