202306-NEA-DZ-FEW/student-store-team-2

Authentication Functionality Errors

Closed this issue · 0 comments

Issue: Authentication Functionality Errors

Description

The authentication functionality is encountering multiple issues, impacting various aspects of the application.

Cookie Modification Restriction Error

A recurring error has been identified, restricting cookie modifications exclusively to Server Actions or Route Handlers, leading to the following error message:

⨯ Error: Cookies can only be modified in a Server Action or Route Handler. Read more: https://nextjs.org/docs/app/api-reference/functions/cookies#cookiessetname-value-options at Object.set (./src/lib/_supabaseAuth.js:31:29) at Array.map (<anonymous>) digest: "2545603463"

This limitation is causing functional obstacles, particularly impacting the signup process.

Signup Process Issues

The signup process is experiencing functional issues likely linked to the aforementioned cookie modification restriction error. Specific details regarding the signup process malfunction or obstacles are needed to accurately diagnose and address this issue.

User Data Fetch Breaking DOM

Fetching user data is causing unexpected behavior, resulting in the breaking of the DOM structure. This issue is disrupting the overall user interface and functionality of the application.

Tasks

  1. Resolve Cookie Modification Restriction Error:

    • Review the code within _supabaseAuth.js (line 31) and any related areas where cookie modifications occur outside of Server Actions or Route Handlers.
    • Refactor the code to align with Next.js guidelines, ensuring cookie modifications strictly adhere to designated areas.
    • Test thoroughly to validate the resolution of the error and ensure the application functions smoothly without encountering this limitation.
    • Proposed Solution: Pass the server action as a prop instead of directly importing it within _supabaseAuth.js. This can enhance flexibility and compliance with Next.js guidelines.
  2. Investigate and Rectify Signup Process Issues:

    • Identify and address any obstacles within the signup process caused by the cookie modification restriction error or other potential factors.
    • Test the signup functionality rigorously to ensure a seamless user experience without errors or disruptions.
  3. Investigate User Data Fetching Issue:

    • Review the code responsible for fetching user data and analyze its impact on the DOM structure.
    • Identify any faulty logic or data handling procedures that may lead to DOM breakage during data retrieval.
    • Implement debugging measures and conduct tests to isolate the root cause of the DOM breakage.
  4. Resolve User Data Fetching Issue:

    • Rectify the code responsible for data retrieval to prevent DOM breakage while ensuring successful user data fetching.
    • Test thoroughly to validate the fix and confirm that fetching user data does not disrupt the application's DOM.

Expected Outcome

  • The cookie modification restriction error is resolved, allowing modifications only within Server Actions or Route Handlers.
  • The signup process functions seamlessly without encountering errors attributed to cookie modification limitations or any other issues.
  • User data fetching is rectified, ensuring it does not disrupt the DOM structure or overall functionality of the application.