Skip to content

[BUG] fix(ai): resolve CSRF token error in AI Assistant: #2173

Description

@sam-dwdkr404

Bug Description

Bug Description

The AI Assistant currently fails when a user submits a question and returns the following error:

Error: CSRF token missing or invalid.

Steps to Reproduce

  1. Open PrepPilot AI.
  2. Navigate to the AI Assistant.
  3. Enter a question such as:
    what to study for sde?
  4. Submit the question.

Actual Behavior

The assistant does not return an AI-generated response and instead displays:

Error: CSRF token missing or invalid.

Expected Behavior

The AI Assistant should successfully process the user's question and return the generated response without a CSRF validation error.

Impact

This prevents users from using the AI Assistant for interview preparation.

Environment

  • PrepPilot AI web application
  • AI Assistant

Steps to Reproduce

  1. Open PrepPilot.
  2. Navigate to the DSA section.
  3. Open DSA Master Sheets.
  4. Click any sheet, such as Arrays Practice, GFG Must-Know DSA Sheet, Love Babbar DSA Sheet, NeetCode 150, or Striver SDE Sheet.
  5. Observe the result.

Expected Behavior

The selected DSA sheet should open normally and display its problems and content.

Actual Behavior

The application displays an error page:

Oops! Something Went Wrong

with the error:

Cannot access 'P' before initialization

The selected sheet does not load correctly.

Severity

High

Screenshots / Screen Recording

Image

Browser

No response

Operating System

No response

Additional Context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingclaimedThis issue has been claimed by a contributorstale

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions