Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Registering always returns: "E-Mail address already in use" #88

Open
kromonos opened this issue Nov 8, 2023 · 6 comments
Open

Registering always returns: "E-Mail address already in use" #88

kromonos opened this issue Nov 8, 2023 · 6 comments

Comments

@kromonos
Copy link

kromonos commented Nov 8, 2023

Ferdium-Server: ferdium/ferdium-server:latest

image

image

docker compose:

version: "3.8"
services:
  ferdium-server:
    #image: ferdium/ferdium-server:1.3.16
    image: ferdium/ferdium-server:latest
    container_name: ferdium-server
    environment:
      TZ: 'Europe/Berlin'
      NODE_ENV: 'production'
      #NODE_ENV: 'development'
      APP_URL: 'https://<uri>'
      DB_CONNECTION: 'pg'
      DB_HOST: '127.0.0.1'
      DB_PORT: 5432
      DB_USER: '<un>'
      DB_PASSWORD: '<pw>'
      DB_DATABASE: '<db>'
      DB_SSL: false
      MAIL_CONNECTION: 'smtp'
      SMTP_HOST: '<srv>'
      SMTP_PORT: 465
      MAIL_SSL: true
      MAIL_USERNAME: '<un>'
      MAIL_PASSWORD: '<pw>'
      MAIL_SENDER: '<un>'
      IS_CREATION_ENABLED: true
      IS_DASHBOARD_ENABLED: true
      IS_REGISTRATION_ENABLED: true
      CONNECT_WITH_FRANZ: false
      DATA_DIR: '/data'
      HOST: 127.0.0.1
      PORT: 3017
      JWT_USE_PEM: true
      CACHE_VIEWS: false
    volumes:
      - ferdium-database:/data
      - ferdium-recipes:/app/build/recipes
    restart: unless-stopped
    network_mode: host

volumes:
  ferdium-recipes:
  ferdium-database:

Maybe because of missing recipes, which can't load, because of wrong Node version? See #84 (comment)

**** Generating recipes for first run ****
Cloning into 'recipes'...
npm WARN using --force Recommended protections disabled.

added 1 package in 2s

1 package is looking for funding
  run `npm fund` for details
npm notice
npm notice New major version of npm available! 9.8.1 -> 10.2.3
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.2.3>
npm notice Run `npm install -g [email protected]` to update!
npm notice
 ERR_PNPM_UNSUPPORTED_ENGINE  Unsupported environment (bad pnpm and/or Node.js version)

Your Node version is incompatible with "/app/recipes".

Expected version: 20.9.0
Got: v18.18.0
10:14AM 50 2023/11/08 10:14AM 2023/11/08 10:14AM 50 pid=146 hostname=<hn> name=ferdium-server err={"type":"Error","message":"/app/build/recipes/all.json: ENOENT: no such file or directory, open '/app/build/recipes/all.json'","stack":"Error: /app/build/recipes/all.json: ENOENT: no such file or directory, open '/app/build/recipes/all.json'\n    at Object.openSync (node:fs:603:3)\n    at Object.readFileSync (node:fs:471:35)\n    at Object.readFileSync (/app/node_modules/.pnpm/[email protected]/node_modules/jsonfile/index.js:50:22)\n    at RecipesController.list (/app/app/Controllers/Http/RecipeController.ts:53:32)\n    at Injector.callAsync (/app/node_modules/.pnpm/@[email protected]/node_modules/@adonisjs/fold/build/src/Ioc/Injector.js:124:30)","errno":-2,"syscall":"open","code":"ENOENT","path":"/app/build/recipes/all.json","status":500} msg=/app/build/recipes/all.json: ENOENT: no such file or directory, open '/app/build/recipes/all.json'
@npXXX
Copy link

npXXX commented Dec 2, 2023

I have the same issue but with a "non-docker" setup, when trying to register a new account I always get the response "E-Mail address already in use". Dev tools show a 401 Unauthorized on /v1/auth/signup route

@thetonk
Copy link

thetonk commented Dec 9, 2023

I face the same issue, with clean installation of latest version on docker, using mySQL/mariaDB database. Server fails to insert new users on database, throwing the same 401 error mentioned, although database connection is working properly since it gets populated with tables and the initial migration entries. Using the default SQLite database by adding the proper user and group on docker compose, it registers new users without any problems. Probably something is wrong with remote database management.

@357up
Copy link

357up commented Jan 19, 2024

This is issue with table's users (more specifically the column password) schema in MySQL (I haven't tested postgres or sqlite).
This is the schema created by the application:

CREATE TABLE `users` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `username` varchar(80) NOT NULL,
  `email` varchar(254) NOT NULL,
  `password` varchar(60) NOT NULL,
  `settings` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`settings`)),
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  `lastname` varchar(80) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`),
  UNIQUE KEY `users_email_unique` (`email`)
)

As we can see the max size of the password field is 60.
However, using strace command, I was able to retrieve the SQL insert application generates upon signup:
Ekrānuzņēmums 2024-01-19 130459

The resulting hashed password was 133 characters long and the insert just errored out.

Most important issue is probably that the error handling when interacting with DB is either missing or broken. And of course, the schema should be fixed as well.

For those that are running into this issue (while the schema hasn't been fixed by the maintainers), running following SQL should fix the issue:

ALTER TABLE `users` MODIFY `password` VARCHAR(254) NOT NULL;

@kromonos
Copy link
Author

@357up nice workaround. Thanks for this :)

@thuvh
Copy link

thuvh commented Feb 16, 2024

This is issue with table's users (more specifically the column password) schema in MySQL (I haven't tested postgres or sqlite). This is the schema created by the application:

I haven't got any problems with postgres.

@bioluks
Copy link

bioluks commented Mar 26, 2024

I myself was getting the nodejs warning, that v20.11.0 isn't enough for the recipes. Built the container myself wth the official Dockerfile which fixed this issue immediately. Since I'm no database pro the comment from @357up really solved the "E-Mail already in use" error for me as well! As a PostgreSQL user the command changes a little bit:

ALTER TABLE users ALTER COLUMN password TYPE varchar(254) ALTER COLUMN password SET NOT NULL;

Sad to see it's not fixed since November '23, since this is probably affecting all new instances. Will send a PR probably.

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

No branches or pull requests

6 participants