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

Peertube fails to start on query error #6599

Closed
patit72 opened this issue Sep 20, 2024 · 12 comments
Closed

Peertube fails to start on query error #6599

patit72 opened this issue Sep 20, 2024 · 12 comments
Labels
Status: Waiting for answer Waiting issue author answer

Comments

@patit72
Copy link

patit72 commented Sep 20, 2024

Describe the problem

when I run NODE_ENV=production NODE_CONFIG_DIR=/var/www/peertube/config node dist/server manually server fails to start with error

error: Cannot start application. { "err": { "stack": "Error\n at Query.run (/var/www/peertube/versions/peertube-v6.2.1/node_modules/sequelize/lib/dialects/postgres/query.js:50:25)\n at /var/www/peertube/versions/peertube-v6.2.1/node_modules/sequelize/lib/sequelize.js:315:28\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async migrate (file:///var/www/peertube/versions/peertube-v6.2.1/dist/core/initializers/migrator.js:23:9)", "message": "null value in column \"nodeVersion\" of relation \"application\" violates not-null constraint", "name": "SequelizeDatabaseError", "parent": { "stack": "error: null value in column \"nodeVersion\" of relation \"application\" violates not-null constraint\n at Parser.parseErrorMessage (/var/www/peertube/versions/peertube-v6.2.1/node_modules/pg-protocol/dist/parser.js:283:98)\n at Parser.handlePacket (/var/www/peertube/versions/peertube-v6.2.1/node_modules/pg-protocol/dist/parser.js:122:29)\n at Parser.parse (/var/www/peertube/versions/peertube-v6.2.1/node_modules/pg-protocol/dist/parser.js:35:38)\n at Socket.<anonymous> (/var/www/peertube/versions/peertube-v6.2.1/node_modules/pg-protocol/dist/index.js:11:42)\n at Socket.emit (node:events:520:28)\n at addChunk (node:internal/streams/readable:559:12)\n at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)\n at Readable.push (node:internal/streams/readable:390:5)\n at TCP.onStreamRead (node:internal/stream_base_commons:191:23)", "message": "null value in column \"nodeVersion\" of relation \"application\" violates not-null constraint", "length": 236, "name": "error", "severity": "ERROR", "code": "23502", "detail": "Failing row contains (510, 0, null, null, null).", "schema": "public", "table": "application", "column": "nodeVersion", "file": "execMain.c", "line": "1883", "routine": "ExecConstraints", "sql": "INSERT INTO \"application\" (\"migrationVersion\") VALUES (0)" }, "sql": "INSERT INTO \"application\" (\"migrationVersion\") VALUES (0)", "parameters": {} } }

Additional information

  • PeerTube instance URL:
  • PeerTube version: 6.2.1
  • NodeJS version: 22.8.0
  • Ffmpeg version:
  • Redis version:
  • PostgreSQL version:
@Chocobozzz
Copy link
Owner

Please drop and re-create your database, then start peertube and paste the logs output

@Chocobozzz Chocobozzz added the Status: Waiting for answer Waiting issue author answer label Sep 20, 2024
@patit72
Copy link
Author

patit72 commented Sep 20, 2024

I already tried that with the same result;

@Chocobozzz
Copy link
Owner

Please paste the entiere application output

@patit72
Copy link
Author

patit72 commented Sep 20, 2024

[peertube.redacted.it:443 uploadx] 2024-09-20 09:52:31.630 debug: DiskStorage config: {
  directory: '/var/www/peertube/storage/tmp/resumable-uploads',
  expiration: { maxAge: undefined, rolling: true },
  maxMetadataSize: '10MB',
  logger: [Function: Object],
  userIdentifier: [Function: userIdentifier],
  filename: [Function: filename]
}
[peertube.redacted.it:443 uploadx] 2024-09-20 09:52:31.646 debug: Registered handlers: DELETE, GET, OPTIONS, PATCH, POST, PUT
[peertube.redacted.it:443] 2024-09-20 09:52:32.666 debug: Checking NodeJS version v22.8.0.
[peertube.redacted.it:443] 2024-09-20 09:52:32.669 info: Using following configuration file hierarchy: /var/www/peertube/config/default.yaml -> /var/www/peertube/config/production.yaml.
[peertube.redacted.it:443] 2024-09-20 09:52:32.671 warn: SMTP is not configured so the contact form will not work.
(node:1650) [DEP0044] DeprecationWarning: The `util.isArray` API is deprecated. Please use `Array.isArray()` instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:1650) [DEP0055] DeprecationWarning: The `util.isRegExp` API is deprecated. Please use `arg instanceof RegExp` instead.
(node:1650) [DEP0047] DeprecationWarning: The `util.isDate` API is deprecated.  Please use `arg instanceof Date` instead.
[peertube.redacted.it:443] 2024-09-20 09:52:33.007 debug: Executed SQL request - Executing (default): SELECT 1+1 AS result
[peertube.redacted.it:443] 2024-09-20 09:52:33.010 debug: Executed SQL request - Executing (default): SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' AND table_type LIKE '%TABLE' AND table_name != 'spatial_ref_sys';
[peertube.redacted.it:443] 2024-09-20 09:52:33.013 debug: Connection to PostgreSQL has been established successfully.
[peertube.redacted.it:443] 2024-09-20 09:52:33.024 debug: Executed SQL request - Executing (default): SELECT "migrationVersion" FROM "application"
[peertube.redacted.it:443] 2024-09-20 09:52:33.028 debug: Executed SQL request - Executing (default): INSERT INTO "application" ("migrationVersion") VALUES (0)
[peertube.redacted.it:443] 2024-09-20 09:52:33.034 error: Cannot start application. {
  "err": {
    "stack": "Error\n    at Query.run (/var/www/peertube/versions/peertube-v6.2.1/node_modules/sequelize/lib/dialects/postgres/query.js:50:25)\n    at /var/www/peertube/versions/peertube-v6.2.1/node_modules/sequelize/lib/sequelize.js:315:28\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async migrate (file:///var/www/peertube/versions/peertube-v6.2.1/dist/core/initializers/migrator.js:23:9)",
    "message": "null value in column \"nodeVersion\" of relation \"application\" violates not-null constraint",
    "name": "SequelizeDatabaseError",
    "parent": {
      "stack": "error: null value in column \"nodeVersion\" of relation \"application\" violates not-null constraint\n    at Parser.parseErrorMessage (/var/www/peertube/versions/peertube-v6.2.1/node_modules/pg-protocol/dist/parser.js:283:98)\n    at Parser.handlePacket (/var/www/peertube/versions/peertube-v6.2.1/node_modules/pg-protocol/dist/parser.js:122:29)\n    at Parser.parse (/var/www/peertube/versions/peertube-v6.2.1/node_modules/pg-protocol/dist/parser.js:35:38)\n    at Socket.<anonymous> (/var/www/peertube/versions/peertube-v6.2.1/node_modules/pg-protocol/dist/index.js:11:42)\n    at Socket.emit (node:events:520:28)\n    at addChunk (node:internal/streams/readable:559:12)\n    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)\n    at Readable.push (node:internal/streams/readable:390:5)\n    at TCP.onStreamRead (node:internal/stream_base_commons:191:23)",
      "message": "null value in column \"nodeVersion\" of relation \"application\" violates not-null constraint",
      "length": 235,
      "name": "error",
      "severity": "ERROR",
      "code": "23502",
      "detail": "Failing row contains (15, 0, null, null, null).",
      "schema": "public",
      "table": "application",
      "column": "nodeVersion",
      "file": "execMain.c",
      "line": "1883",
      "routine": "ExecConstraints",
      "sql": "INSERT INTO \"application\" (\"migrationVersion\") VALUES (0)"
    },
    "sql": "INSERT INTO \"application\" (\"migrationVersion\") VALUES (0)",
    "parameters": {}
  }
}

@MattyBoombalatty
Copy link

Please see this as it might work for you too.

#6592 (comment)

@patit72
Copy link
Author

patit72 commented Sep 20, 2024

Please see this as it might work for you too.

#6592 (comment)

Thanks, mine is a brand new installation, Shail I try it as well?

@MattyBoombalatty
Copy link

Are you on 6.2.1 or 6.3.0 with the brand new installation?

@patit72
Copy link
Author

patit72 commented Sep 20, 2024

6.2.1

@Chocobozzz
Copy link
Owner

@patit72 Logs you pasted is not the first start of PeerTube on a fresh database. Can you retry to delete and recreate your database and run PeerTube?

@cintek
Copy link

cintek commented Oct 4, 2024

@patit72 I also had that error but with 6.3.0. Next time I tried again it was gone. That time I used 6.3.1 and there also was an update for nodejs so it might be that one of those did fix the problem (I guess it was not the update of Peertube because of what I read in the release notes).

@kontrollanten
Copy link
Contributor

It happened to me today when running develop branch on a pure new docker container (without any previous data). I removed the container and started again, then it worked.

@Chocobozzz
Copy link
Owner

Closing this issue without @patit72 answer to #6599 (comment)

Don't hesitate to comment even if the issue is closed, we can reopen it :)

@cintek & @kontrollanten In most cases, this problem occurs because the database was not created correctly the first time PeerTube was started. Subsequent starts will cause PeerTube to crash. It's the reason why pasting the first output start is important. If you notice interesting things in your logs, please create a dedicated issue so we can fix it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Waiting for answer Waiting issue author answer
Projects
None yet
Development

No branches or pull requests

5 participants