Skip to content

Is this project ready to use?Β #3

@lexcorp

Description

@lexcorp

Is this project ready to use?

I get this errors when execute setup.sh:

./scripts/setup.sh
πŸš€ Setting up Baileys WhatsApp API...
βœ… Node.js version: v22.16.0
βœ… Using NPM package manager
πŸ“¦ Installing dependencies...
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated lodash.get@4.4.2: This package is deprecated. Use the optional chaining (?.) operator instead.
npm warn deprecated phin@2.9.3: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm warn deprecated rimraf@2.7.1: Rimraf versions prior to v4 are no longer supported
npm warn deprecated lodash.isequal@4.5.0: This package is deprecated. Use require('node:util').isDeepStrictEqual instead.
npm warn deprecated @humanwhocodes/config-array@0.13.0: Use @eslint/config-array instead
npm warn deprecated abab@2.0.6: Use your platform's native atob() and btoa() methods instead
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
npm warn deprecated glob@8.1.0: Glob versions prior to v9 are no longer supported
npm warn deprecated domexception@2.0.1: Use your platform's native DOMException instead
npm warn deprecated glob@7.1.6: Glob versions prior to v9 are no longer supported
npm warn deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
npm warn deprecated q@1.5.1: You or someone you depend on is using Q, the JavaScript Promise library that gave JavaScript developers strong feelings about promises. They can almost certainly migrate to the native JavaScript promise now. Thank you literally everyone for joining me in this bet against the odds. Be excellent to each other.
npm warn deprecated
npm warn deprecated (For a CapTP with native promises, see @endo/eventual-send and @endo/captp)
npm warn deprecated multer@1.4.5-lts.2: Multer 1.x is impacted by a number of vulnerabilities, which have been patched in 2.x. You should upgrade to the latest 2.x version.
npm warn deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm warn deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead
npm warn deprecated vm2@3.9.19: The library contains critical security issues and should not be used for production! The maintenance of the project has been discontinued. Consider migrating your code to isolated-vm.
npm warn deprecated eslint@8.57.1: This version is no longer supported. Please see https://eslint.org/version-support for other options.

baileys-api@1.0.0 preinstall
node ./engine-requirements.js

baileys-api@1.0.0 prepare
tsc

src/Socket/messages-send.ts:537:7 - error TS2322: Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.

537 id: msgId,
~~

src/WABinary/types.ts:11:14
11 attrs: { [key: string]: string }
~~~~~~~~~~~~~~~~~~~~~
The expected type comes from this index signature.

src/WABinary/generic-utils.ts:9:10 - error TS18048: 'node' is possibly 'undefined'.

9 return node.content.filter(item => item.tag === childTag)
~~~~

src/WAUSync/Protocols/USyncDeviceProtocol.ts:51:33 - error TS18048: 'deviceListNode' is possibly 'undefined'.

51 for(const { tag, attrs } of deviceListNode.content) {
~~~~~~~~~~~~~~

src/app.ts:15:24 - error TS2307: Cannot find module './utils/apiLogger' or its corresponding type declarations.

15 import { logger } from './utils/apiLogger';
~~~~~~~~~~~~~~~~~~~

src/app.ts:148:10 - error TS2300: Duplicate identifier 'whatsAppService'.

148 export { whatsAppService };
~~~~~~~~~~~~~~~

src/app.ts:179:19 - error TS2300: Duplicate identifier 'whatsAppService'.

179 export { app, io, whatsAppService };
~~~~~~~~~~~~~~~

src/middleware/auth.ts:4:48 - error TS2307: Cannot find module '../types/api' or its corresponding type declarations.

4 import { AuthenticatedRequest, ApiError } from '../types/api';
~~~~~~~~~~~~~~

src/middleware/auth.ts:7:16 - error TS2664: Invalid module name in augmentation, module '../types/api' cannot be found.

7 declare module '../types/api' {
~~~~~~~~~~~~~~

src/middleware/auth.ts:12:24 - error TS2307: Cannot find module '../utils/apiLogger' or its corresponding type declarations.

12 import { logger } from '../utils/apiLogger';
~~~~~~~~~~~~~~~~~~~~

src/middleware/errorHandler.ts:4:24 - error TS2307: Cannot find module '../utils/apiLogger' or its corresponding type declarations.

4 import { logger } from '../utils/apiLogger';
~~~~~~~~~~~~~~~~~~~~

src/middleware/errorHandler.ts:5:26 - error TS2307: Cannot find module '../types/api' or its corresponding type declarations.

5 import { ApiError } from '../types/api';
~~~~~~~~~~~~~~

src/middleware/errorHandler.ts:129:20 - error TS2339: Property 'param' does not exist on type 'ValidationError'.
Property 'param' does not exist on type 'AlternativeValidationError'.

129 field: error.param,
~~~~~

src/middleware/errorHandler.ts:131:20 - error TS2339: Property 'value' does not exist on type 'ValidationError'.
Property 'value' does not exist on type 'AlternativeValidationError'.

131 value: error.value,
~~~~~

src/middleware/errorHandler.ts:132:23 - error TS2339: Property 'location' does not exist on type 'ValidationError'.
Property 'location' does not exist on type 'AlternativeValidationError'.

132 location: error.location
~~~~~~~~

src/routes/auth.ts:7:26 - error TS2459: Module '"../middleware/auth"' declares 'AuthenticatedRequest' locally, but it is not exported.

7 import { authMiddleware, AuthenticatedRequest } from '../middleware/auth';
~~~~~~~~~~~~~~~~~~~~

src/middleware/auth.ts:4:10
4 import { AuthenticatedRequest, ApiError } from '../types/api';
~~~~~~~~~~~~~~~~~~~~
'AuthenticatedRequest' is declared here.

src/routes/auth.ts:8:29 - error TS2307: Cannot find module '../types/api' or its corresponding type declarations.

8 import { ApiResponse } from '../types/api';
~~~~~~~~~~~~~~

src/routes/auth.ts:86:17 - error TS2769: No overload matches this call.
Overload 1 of 5, '(payload: string | object | Buffer, secretOrPrivateKey: null, options?: (SignOptions & { algorithm: "none"; }) | undefined): string', gave the following error.
Argument of type 'string' is not assignable to parameter of type 'null'.
Overload 2 of 5, '(payload: string | object | Buffer, secretOrPrivateKey: Secret | JsonWebKeyInput | PrivateKeyInput, options?: SignOptions | undefined): string', gave the following error.
Type 'string' is not assignable to type 'number | StringValue | undefined'.
Overload 3 of 5, '(payload: string | object | Buffer, secretOrPrivateKey: Secret | JsonWebKeyInput | PrivateKeyInput, callback: SignCallback): void', gave the following error.
Argument of type '{ expiresIn: string; }' is not assignable to parameter of type 'SignCallback'.
Object literal may only specify known properties, and 'expiresIn' does not exist in type 'SignCallback'.

86 const token = jwt.sign(
~~~~~~~~~
87 { userId: user.id },
~~~~~~~~~~~~~~~~~~~~~~~~
...
89 { expiresIn: process.env.JWT_EXPIRES_IN || '7d' }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
90 );
~~~

src/routes/auth.ts:160:17 - error TS2769: No overload matches this call.
Overload 1 of 5, '(payload: string | object | Buffer, secretOrPrivateKey: null, options?: (SignOptions & { algorithm: "none"; }) | undefined): string', gave the following error.
Argument of type 'string' is not assignable to parameter of type 'null'.
Overload 2 of 5, '(payload: string | object | Buffer, secretOrPrivateKey: Secret | JsonWebKeyInput | PrivateKeyInput, options?: SignOptions | undefined): string', gave the following error.
Type 'string' is not assignable to type 'number | StringValue | undefined'.
Overload 3 of 5, '(payload: string | object | Buffer, secretOrPrivateKey: Secret | JsonWebKeyInput | PrivateKeyInput, callback: SignCallback): void', gave the following error.
Argument of type '{ expiresIn: string; }' is not assignable to parameter of type 'SignCallback'.
Object literal may only specify known properties, and 'expiresIn' does not exist in type 'SignCallback'.

160 const token = jwt.sign(
~~~~~~~~~
161 { userId: user.id },
~~~~~~~~~~~~~~~~~~~~~~~~
...
163 { expiresIn: process.env.JWT_EXPIRES_IN || '7d' }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
164 );
~~~

src/routes/business.ts:6:29 - error TS2307: Cannot find module '../types/api' or its corresponding type declarations.

6 import { ApiResponse } from '../types/api';
~~~~~~~~~~~~~~

src/routes/chats.ts:7:29 - error TS2307: Cannot find module '../types/api' or its corresponding type declarations.

7 import { ApiResponse } from '../types/api';
~~~~~~~~~~~~~~

src/routes/contacts.ts:7:29 - error TS2307: Cannot find module '../types/api' or its corresponding type declarations.

7 import { ApiResponse } from '../types/api';
~~~~~~~~~~~~~~

src/routes/dashboard.ts:8:29 - error TS2307: Cannot find module '../types/api' or its corresponding type declarations.

8 import { ApiResponse } from '../types/api';
~~~~~~~~~~~~~~

src/routes/dashboard.ts:54:28 - error TS2339: Property 'status' does not exist on type 'Promise'.

54 status: liveSession?.status || session.status,
~~~~~~

src/routes/groups.ts:6:29 - error TS2307: Cannot find module '../types/api' or its corresponding type declarations.

6 import { ApiResponse } from '../types/api';
~~~~~~~~~~~~~~

src/routes/media.ts:6:29 - error TS2307: Cannot find module '../types/api' or its corresponding type declarations.

6 import { ApiResponse } from '../types/api';
~~~~~~~~~~~~~~

src/routes/messages.ts:8:62 - error TS2307: Cannot find module '../types/api' or its corresponding type declarations.

8 import { ApiResponse, SendMessageRequest, MessageType } from '../types/api';
~~~~~~~~~~~~~~

src/routes/sessions.ts:7:44 - error TS2307: Cannot find module '../types/api' or its corresponding type declarations.

7 import { ApiResponse, SessionStatus } from '../types/api';
~~~~~~~~~~~~~~

src/routes/sessions.ts:32:32 - error TS2339: Property 'status' does not exist on type 'Promise'.

32 liveStatus: liveSession?.status || SessionStatus.DISCONNECTED,
~~~~~~

src/routes/sessions.ts:33:28 - error TS2339: Property 'qrCode' does not exist on type 'Promise'.

33 qrCode: liveSession?.qrCode,
~~~~~~

src/routes/sessions.ts:34:33 - error TS2339: Property 'pairingCode' does not exist on type 'Promise'.

34 pairingCode: liveSession?.pairingCode
~~~~~~~~~~~

src/routes/webhooks.ts:6:29 - error TS2307: Cannot find module '../types/api' or its corresponding type declarations.

6 import { ApiResponse } from '../types/api';
~~~~~~~~~~~~~~

src/services/DatabaseService.ts:2:24 - error TS2307: Cannot find module '../utils/apiLogger' or its corresponding type declarations.

2 import { logger } from '../utils/apiLogger';
~~~~~~~~~~~~~~~~~~~~

src/services/DatabaseService.ts:31:23 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'.

31 this.prisma.$on('query', (e) => {
~~~~~~~

src/services/DatabaseService.ts:33:20 - error TS2339: Property 'query' does not exist on type 'never'.

33 query: e.query,
~~~~~

src/services/DatabaseService.ts:34:21 - error TS2339: Property 'params' does not exist on type 'never'.

34 params: e.params,
~~~~~~

src/services/DatabaseService.ts:35:23 - error TS2339: Property 'duration' does not exist on type 'never'.

35 duration: e.duration
~~~~~~~~

src/services/DatabaseService.ts:40:21 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'.

40 this.prisma.$on('error', (e) => {
~~~~~~~

src/services/DatabaseService.ts:42:19 - error TS2339: Property 'target' does not exist on type 'never'.

42 target: e.target,
~~~~~~

src/services/DatabaseService.ts:43:20 - error TS2339: Property 'message' does not exist on type 'never'.

43 message: e.message
~~~~~~~

src/services/DatabaseService.ts:47:21 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'.

47 this.prisma.$on('info', (e) => {
~~~~~~

src/services/DatabaseService.ts:49:19 - error TS2339: Property 'target' does not exist on type 'never'.

49 target: e.target,
~~~~~~

src/services/DatabaseService.ts:50:20 - error TS2339: Property 'message' does not exist on type 'never'.

50 message: e.message
~~~~~~~

src/services/DatabaseService.ts:54:21 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'.

54 this.prisma.$on('warn', (e) => {
~~~~~~

src/services/DatabaseService.ts:56:19 - error TS2339: Property 'target' does not exist on type 'never'.

56 target: e.target,
~~~~~~

src/services/DatabaseService.ts:57:20 - error TS2339: Property 'message' does not exist on type 'never'.

57 message: e.message
~~~~~~~

src/services/DatabaseService.ts:374:35 - error TS2322: Type '{ userId: string; } | { userId?: undefined; }' is not assignable to type 'MessageWhereInput | undefined'.
Type '{ userId: string; }' has no properties in common with type 'MessageWhereInput'.

374 this.prisma.message.count({ where }),
~~~~~

src/services/WebhookService.ts:4:31 - error TS2307: Cannot find module '../utils/apiLogger' or its corresponding type declarations.

4 import { webhookLogger } from '../utils/apiLogger';
~~~~~~~~~~~~~~~~~~~~

src/services/WebhookService.ts:31:76 - error TS2345: Argument of type 'string | null' is not assignable to parameter of type 'string | undefined'.
Type 'null' is not assignable to type 'string | undefined'.

31 await this.deliverWebhook(webhook.id, webhook.url, event, payload, webhook.secret);
~~~~~~~~~~~~~~

src/services/WebhookService.ts:231:85 - error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'?

231 async verifyWebhookSignature(payload: string, signature: string, secret: string): boolean {
~~~~~~~

src/services/WhatsAppService.ts:16:40 - error TS2307: Cannot find module '../utils/apiLogger' or its corresponding type declarations.

16 import { logger, whatsappLogger } from '../utils/apiLogger';
~~~~~~~~~~~~~~~~~~~~

src/services/WhatsAppService.ts:19:48 - error TS2307: Cannot find module '../types/api' or its corresponding type declarations.

19 import { WhatsAppSession, SessionStatus } from '../types/api';
~~~~~~~~~~~~~~

Found 51 errors in 19 files.

Errors Files
1 src/Socket/messages-send.ts:537
1 src/WABinary/generic-utils.ts:9
1 src/WAUSync/Protocols/USyncDeviceProtocol.ts:51
3 src/app.ts:15
3 src/middleware/auth.ts:4
5 src/middleware/errorHandler.ts:4
4 src/routes/auth.ts:7
1 src/routes/business.ts:6
1 src/routes/chats.ts:7
1 src/routes/contacts.ts:7
2 src/routes/dashboard.ts:8
1 src/routes/groups.ts:6
1 src/routes/media.ts:6
1 src/routes/messages.ts:8
4 src/routes/sessions.ts:7
1 src/routes/webhooks.ts:6
15 src/services/DatabaseService.ts:2
3 src/services/WebhookService.ts:4
2 src/services/WhatsAppService.ts:16
npm error code 2
npm error path /home/admin/Descargas/Baileys-2025-Rest-API
npm error command failed
npm error command sh -c tsc
npm error A complete log of this run can be found in: /home/admin/.npm/_logs/2025-06-01T06_11_40_686Z-debug-0.log
πŸ“ Creating directories...
πŸ—„οΈ Generating Prisma client...
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma

βœ” Generated Prisma Client (v5.22.0) to ./node_modules/@prisma/client in 146ms

Start by importing your Prisma Client (See: https://pris.ly/d/importing-client)

Tip: Curious about the SQL queries Prisma ORM generates? Optimize helps you enhance your visibility: https://pris.ly/tip-2-optimize

βœ… Setup complete!

Next steps:

  1. Configure your PostgreSQL database in .env
  2. Run database migrations: npm migrate
  3. Start the development server: npm dev

The API will be available at: http://localhost:3001
Dashboard: http://localhost:3001/dashboard
API Docs: http://localhost:3001/api-docs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions