NOT NULL constraint failed: twoFactor.id #82

Closed
opened 2026-03-13 07:32:24 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @rachhen on GitHub (Oct 16, 2024).

Describe the bug
I want to enable Two Factor but it return error and the Two Factor status in user is enabled. When send request to get TOTP it response error 400 totp isn't enabled.

To Reproduce
Steps to reproduce the behavior:

  1. Login the user using email and password
  2. Go to the user settings
  3. Click on Enabled 2FA
  4. Popup enter user password and submit
  5. NOT NULL constraint failed: twoFactor.id

Expected behavior
It should successfully enabled 2fa and can Scan QR code.

Screenshots
If applicable, add screenshots to help explain your problem.

https://github.com/user-attachments/assets/049c1635-74db-4424-ad5b-87e51755d3cc

image

Desktop (please complete the following information):

  • OS: Mac OS
  • Browser: Chrome
  • Version: 129.0.6668.90

Additional context

ERROR   NOT NULL constraint failed: twoFactor.id

Generated SQL from Drizzle Adapter:

insert into "twoFactor" ("id", "secret", "backupCodes", "userId") values (null, ?, ?, ?) returning "id", "secret", "backupCodes", "userId" 
-- params: ["a0f01dc094fe2db0f6e80f39e5baf882fd0cf9680e664615c8f23bc734b5b11a01743fd5f11e00bc914b477f456c068008cc075b06bb6a96", "28a0483c57a0bb715118cc34b0391bbaaee1c0360e3c978093316e79fd8f751870e4cd80624d147cfb6e910f6ae261e3f61fdf3ce1456206cebde447e21c0fa4473173ba277867bac0ca6e97cf5d670580a46c40902bc2adc6b58280b78f131845e6546ce171bd86e10fab90fc21263b268b25a8d6aeb2af1c866481eeda44e68a0419010ecbead9bbf0308e7ceead61bf2f311684681372b163634e86a8ea77462b6df300ce196f27e28e278d178debd23889cd65", "Gi4GL4w0zyl3YszpSAzQF"]
Originally created by @rachhen on GitHub (Oct 16, 2024). **Describe the bug** I want to enable Two Factor but it return error and the Two Factor status in user is enabled. When send request to get TOTP it response error 400 `totp isn't enabled`. **To Reproduce** Steps to reproduce the behavior: 1. Login the user using email and password 2. Go to the user settings 3. Click on Enabled 2FA 4. Popup enter user password and submit 5. NOT NULL constraint failed: twoFactor.id **Expected behavior** It should successfully enabled 2fa and can Scan QR code. **Screenshots** If applicable, add screenshots to help explain your problem. https://github.com/user-attachments/assets/049c1635-74db-4424-ad5b-87e51755d3cc <img width="762" alt="image" src="https://github.com/user-attachments/assets/a6066f93-5369-400d-9748-bbcac2870342"> **Desktop (please complete the following information):** - OS: Mac OS - Browser: Chrome - Version: 129.0.6668.90 **Additional context** ``` ERROR NOT NULL constraint failed: twoFactor.id ``` Generated SQL from Drizzle Adapter: ```SQL insert into "twoFactor" ("id", "secret", "backupCodes", "userId") values (null, ?, ?, ?) returning "id", "secret", "backupCodes", "userId" -- params: ["a0f01dc094fe2db0f6e80f39e5baf882fd0cf9680e664615c8f23bc734b5b11a01743fd5f11e00bc914b477f456c068008cc075b06bb6a96", "28a0483c57a0bb715118cc34b0391bbaaee1c0360e3c978093316e79fd8f751870e4cd80624d147cfb6e910f6ae261e3f61fdf3ce1456206cebde447e21c0fa4473173ba277867bac0ca6e97cf5d670580a46c40902bc2adc6b58280b78f131845e6546ce171bd86e10fab90fc21263b268b25a8d6aeb2af1c866481eeda44e68a0419010ecbead9bbf0308e7ceead61bf2f311684681372b163634e86a8ea77462b6df300ce196f27e28e278d178debd23889cd65", "Gi4GL4w0zyl3YszpSAzQF"] ```
Author
Owner

@Bekacru commented on GitHub (Oct 16, 2024):

This should be fixed on latest. Please update and try again, and feel free to reopen if the problem persists.

@Bekacru commented on GitHub (Oct 16, 2024): This should be fixed on latest. Please update and try again, and feel free to reopen if the problem persists.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#82