Hello, I tried to deploy to Heroku and input all the vars required, but the deploy failed.
This is the build log:
-----> Building on the Heroku-20 stack
-----> Determining which buildpack to use for this app
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): >=14.x
engines.npm (package.json): unspecified (use default)
Resolving node version >=14.x...
Downloading and installing node 18.3.0...
Using default npm version: 8.11.0
-----> Installing dependencies
Installing node modules (package.json)
added 301 packages, and audited 302 packages in 12s
58 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
-----> Build
Running build
> [email protected] build
> tsc --build tsconfig.json
src/db/save_and_get_user.ts(27,3): error TS2322: Type 'Document<unknown, any, MergeType<UserSchema, { _id: number; username: string | undefined; first_name: string; last_name: string | undefined; language_code: string | undefined; search_sorting: string; search_type: string; ignored_random_tags: string[]; random_localy: boolean; can_repeat_in_random: boolean; }>> & Omit...' is not assignable to type '(UserSchema & Document<any, any, UserSchema>) | null'.
Type 'Document<unknown, any, MergeType<UserSchema, { _id: number; username: string | undefined; first_name: string; last_name: string | undefined; language_code: string | undefined; search_sorting: string; search_type: string; ignored_random_tags: string[]; random_localy: boolean; can_repeat_in_random: boolean; }>> & Omit...' is not assignable to type 'UserSchema & Document<any, any, UserSchema>'.
Type 'Document<unknown, any, MergeType<UserSchema, { _id: number; username: string | undefined; first_name: string; last_name: string | undefined; language_code: string | undefined; search_sorting: string; search_type: string; ignored_random_tags: string[]; random_localy: boolean; can_repeat_in_random: boolean; }>> & Omit...' is not assignable to type 'UserSchema'.
Types of property '_id' are incompatible.
Type 'number & ObjectId' is not assignable to type 'string'.
src/db/save_and_get_user.ts(41,10): error TS2531: Object is possibly 'null'.
src/db/save_and_get_user.ts(48,6): error TS2531: Object is possibly 'null'.
src/db/save_and_get_user.ts(51,6): error TS2531: Object is possibly 'null'.
src/db/save_and_get_user.ts(54,2): error TS2322: Type '(UserSchema & Document<any, any, UserSchema>) | null' is not assignable to type 'UserSchema & Document<any, any, UserSchema>'.
Type 'null' is not assignable to type 'UserSchema & Document<any, any, UserSchema>'.
Type 'null' is not assignable to type 'UserSchema'.
src/bot/commands/random.ts(42,4): error TS2322: Type 'Document<unknown, any, MergeType<MessageSchema, { chat_id: string; message_id: string; current: number; history: never[]; }>> & Omit<MessageSchema, "history" | ... 2 more ... | "current"> & { ...; } & { ...; }' is not assignable to type 'Message | null'.
Type 'Document<unknown, any, MergeType<MessageSchema, { chat_id: string; message_id: string; current: number; history: never[]; }>> & Omit<MessageSchema, "history" | ... 2 more ... | "current"> & { ...; } & { ...; }' is not assignable to type 'Message'.
Type 'Document<unknown, any, MergeType<MessageSchema, { chat_id: string; message_id: string; current: number; history: never[]; }>> & Omit<MessageSchema, "history" | ... 2 more ... | "current"> & { ...; } & { ...; }' is not assignable to type 'MessageSchema'.
Types of property 'message_id' are incompatible.
Type 'string' is not assignable to type 'number'.
src/bot/commands/random.ts(45,3): error TS2322: Type 'Document<unknown, any, MergeType<MessageSchema, { chat_id: string; message_id: string; current: number; history: never[]; }>> & Omit<MessageSchema, "history" | ... 2 more ... | "current"> & { ...; } & { ...; }' is not assignable to type 'Message | null'.
src/bot/commands/random.ts(55,7): error TS2531: Object is possibly 'null'.
src/bot/commands/random.ts(59,40): error TS2531: Object is possibly 'null'.
src/bot/commands/random.ts(59,56): error TS2531: Object is possibly 'null'.
src/bot/commands/random.ts(63,3): error TS2531: Object is possibly 'null'.
src/bot/commands/random.ts(69,6): error TS2531: Object is possibly 'null'.
src/bot/commands/random.ts(69,26): error TS2531: Object is possibly 'null'.
src/bot/commands/random.ts(75,3): error TS2531: Object is possibly 'null'.
src/bot/commands/random.ts(76,7): error TS2531: Object is possibly 'null'.
src/bot/commands/random.ts(78,17): error TS2531: Object is possibly 'null'.
src/bot/commands/random.ts(79,5): error TS2531: Object is possibly 'null'.
src/bot/commands/random.ts(82,8): error TS2531: Object is possibly 'null'.
src/bot/commands/random.ts(83,5): error TS2531: Object is possibly 'null'.
src/bot/commands/random.ts(91,3): error TS2531: Object is possibly 'null'.
src/bot/commands/random.ts(93,40): error TS2531: Object is possibly 'null'.
src/bot/commands/random.ts(93,56): error TS2531: Object is possibly 'null'.
src/bot/commands/random.ts(106,9): error TS2531: Object is possibly 'null'.
src/bot/commands/random.ts(122,6): error TS2531: Object is possibly 'null'.
src/bot/text_handler.ts(107,24): error TS2345: Argument of type 'any' is not assignable to parameter of type 'never'.
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
Some possible problems:
- Dangerous semver range (>) in engines.node
https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed