Skip to content

Cannot read property 'apiToken' of nul #339

@karak1974

Description

@karak1974

Hello! I'm getting an error:
(node:19) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'apiToken' of null
Don't really know how to deal with it or what cause this, the database start as intended according to the logs.

Host: Debian 11
Arch: amd64

Full relevant log:

libretube-web-1  | Running in production mode
libretube-web-1  |
libretube-web-1  |
libretube-web-1  | > nextube@0.1.0 start /code
libretube-web-1  | > NODE_ENV=production node dist/server.js
libretube-web-1  |
libretube-web-1  |
libretube-web-1  | Thu, 24 Aug 2023 09:08:48 GMT express-session deprecated undefined resave option; provide resave option at dist/server.js:99:41
libretube-web-1  | Thu, 24 Aug 2023 09:08:48 GMT express-session deprecated undefined saveUninitialized option; provide saveUninitialized option at dist/server.js:99:41
libretube-web-1  | > Ready on http://localhost:3000
libretube-web-1  | Executing (default): SELECT 1+1 AS result
libretube-web-1  | Executing (default): CREATE TABLE IF NOT EXISTS "users" ("id"   SERIAL , "username" VARCHAR(255), "password" VARCHAR(255), "active" BOOLEAN, "email" VARCHAR(255), "apiToken" VARCHAR(255), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL, PRIMARY KEY ("id"));
libretube-web-1  | Connection has been established successfully.
libretube-web-1  | Executing (default): SELECT i.relname AS name, ix.indisprimary AS primary, ix.indisunique AS unique, ix.indkey AS indkey, array_agg(a.attnum) as column_indexes, array_agg(a.attname) AS column_names, pg_get_indexdef(ix.indexrelid) AS definition FROM pg_class t, pg_class i, pg_index ix, pg_attribute a WHERE t.oid = ix.indrelid AND i.oid = ix.indexrelid AND a.attrelid = t.oid AND t.relkind = 'r' and t.relname = 'users' GROUP BY i.relname, ix.indexrelid, ix.indisprimary, ix.indisunique, ix.indkey ORDER BY i.relname;
libretube-web-1  | Executing (default): CREATE TABLE IF NOT EXISTS "channels" ("id" VARCHAR(255) , "title" VARCHAR(255), "description" TEXT, "username" VARCHAR(255), "etag" VARCHAR(255), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL, PRIMARY KEY ("id"));
libretube-web-1  | Executing (default): SELECT i.relname AS name, ix.indisprimary AS primary, ix.indisunique AS unique, ix.indkey AS indkey, array_agg(a.attnum) as column_indexes, array_agg(a.attname) AS column_names, pg_get_indexdef(ix.indexrelid) AS definition FROM pg_class t, pg_class i, pg_index ix, pg_attribute a WHERE t.oid = ix.indrelid AND i.oid = ix.indexrelid AND a.attrelid = t.oid AND t.relkind = 'r' and t.relname = 'channels' GROUP BY i.relname, ix.indexrelid, ix.indisprimary, ix.indisunique, ix.indkey ORDER BY i.relname;
libretube-web-1  | Executing (default): CREATE TABLE IF NOT EXISTS "videos" ("id" VARCHAR(255) , "title" VARCHAR(255), "description" TEXT, "publishedAt" TIMESTAMP WITH TIME ZONE, "etag" VARCHAR(255), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL, "channelId" VARCHAR(255) REFERENCES "channels" ("id") ON DELETE SET NULL ON UPDATE CASCADE, PRIMARY KEY ("id"));
libretube-web-1  | Executing (default): SELECT i.relname AS name, ix.indisprimary AS primary, ix.indisunique AS unique, ix.indkey AS indkey, array_agg(a.attnum) as column_indexes, array_agg(a.attname) AS column_names, pg_get_indexdef(ix.indexrelid) AS definition FROM pg_class t, pg_class i, pg_index ix, pg_attribute a WHERE t.oid = ix.indrelid AND i.oid = ix.indexrelid AND a.attrelid = t.oid AND t.relkind = 'r' and t.relname = 'videos' GROUP BY i.relname, ix.indexrelid, ix.indisprimary, ix.indisunique, ix.indkey ORDER BY i.relname;
libretube-web-1  | Executing (default): CREATE TABLE IF NOT EXISTS "thumbnails" ("id"   SERIAL , "type" VARCHAR(255), "url" VARCHAR(255), "width" INTEGER, "height" INTEGER, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL, "channelId" VARCHAR(255) REFERENCES "channels" ("id") ON DELETE SET NULL ON UPDATE CASCADE, "videoId" VARCHAR(255) REFERENCES "videos" ("id") ON DELETE SET NULL ON UPDATE CASCADE, PRIMARY KEY ("id"));
libretube-web-1  | Executing (default): SELECT i.relname AS name, ix.indisprimary AS primary, ix.indisunique AS unique, ix.indkey AS indkey, array_agg(a.attnum) as column_indexes, array_agg(a.attname) AS column_names, pg_get_indexdef(ix.indexrelid) AS definition FROM pg_class t, pg_class i, pg_index ix, pg_attribute a WHERE t.oid = ix.indrelid AND i.oid = ix.indexrelid AND a.attrelid = t.oid AND t.relkind = 'r' and t.relname = 'thumbnails' GROUP BY i.relname, ix.indexrelid, ix.indisprimary, ix.indisunique, ix.indkey ORDER BY i.relname;
libretube-web-1  | Executing (default): CREATE TABLE IF NOT EXISTS "Sessions" ("sid" VARCHAR(32) , "expires" TIMESTAMP WITH TIME ZONE, "data" TEXT, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL, PRIMARY KEY ("sid"));
libretube-web-1  | Executing (default): SELECT i.relname AS name, ix.indisprimary AS primary, ix.indisunique AS unique, ix.indkey AS indkey, array_agg(a.attnum) as column_indexes, array_agg(a.attname) AS column_names, pg_get_indexdef(ix.indexrelid) AS definition FROM pg_class t, pg_class i, pg_index ix, pg_attribute a WHERE t.oid = ix.indrelid AND i.oid = ix.indexrelid AND a.attrelid = t.oid AND t.relkind = 'r' and t.relname = 'Sessions' GROUP BY i.relname, ix.indexrelid, ix.indisprimary, ix.indisunique, ix.indkey ORDER BY i.relname;
libretube-web-1  | Executing (default): SELECT "id", "username", "password", "active", "email", "apiToken", "createdAt", "updatedAt" FROM "users" AS "user" LIMIT 1;
libretube-web-1  | (node:19) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'apiToken' of null
libretube-web-1  |     at _callee4$ (/code/dist/utils/ytapi.js:251:30)
libretube-web-1  |     at tryCatch (/code/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:65:40)
libretube-web-1  |     at Generator.invoke [as _invoke] (/code/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:299:22)
libretube-web-1  |     at Generator.prototype.(anonymous function) [as next] (/code/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:117:21)
libretube-web-1  |     at step (/code/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
libretube-web-1  |     at /code/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13
libretube-web-1  |     at <anonymous>
libretube-web-1  | (node:19) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
libretube-web-1  | (node:19) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
libretube-web-1  | Executing (default): SELECT "id", "username", "password", "active", "email", "apiToken", "createdAt", "updatedAt" FROM "users" AS "user" LIMIT 1;
libretube-web-1  | (node:19) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'apiToken' of null
libretube-web-1  |     at _callee4$ (/code/dist/utils/ytapi.js:251:30)
libretube-web-1  |     at tryCatch (/code/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:65:40)
libretube-web-1  |     at Generator.invoke [as _invoke] (/code/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:299:22)
libretube-web-1  |     at Generator.prototype.(anonymous function) [as next] (/code/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:117:21)
libretube-web-1  |     at step (/code/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
libretube-web-1  |     at /code/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13
libretube-web-1  |     at <anonymous>
libretube-web-1  | (node:19) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
libretube-web-1  | Executing (default): SELECT "id", "username", "password", "active", "email", "apiToken", "createdAt", "updatedAt" FROM "users" AS "user" LIMIT 1;
libretube-web-1  | (node:19) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'apiToken' of null
libretube-web-1  |     at _callee4$ (/code/dist/utils/ytapi.js:251:30)
libretube-web-1  |     at tryCatch (/code/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:65:40)
libretube-web-1  |     at Generator.invoke [as _invoke] (/code/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:299:22)
libretube-web-1  |     at Generator.prototype.(anonymous function) [as next] (/code/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:117:21)
libretube-web-1  |     at step (/code/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
libretube-web-1  |     at /code/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13
libretube-web-1  |     at <anonymous>
libretube-web-1  | (node:19) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions