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

Error: Input is not a correct AsyncAPI document so it cannot be processed. #565

Open
kafle1 opened this issue Mar 1, 2024 · 5 comments
Open

Comments

@kafle1
Copy link

kafle1 commented Mar 1, 2024

Describe the bug
Getting this error:

/home/niraj/Desktop/niraj/work-projects/lmu/lmu_portal_backend/node_modules/.pnpm/@asyncapi+generator@1.13.1_@types+node@20.11.24/node_modules/@asyncapi/generator/lib/generator.js:224
        const err = new Error('Input is not a correct AsyncAPI document so it cannot be processed.');
                    ^
Error: Input is not a correct AsyncAPI document so it cannot be processed.
    at Generator.parseInput (/home/niraj/Desktop/niraj/work-projects/lmu/lmu_portal_backend/node_modules/.pnpm/@asyncapi+generator@1.13.1_@types+node@20.11.24/node_modules/@asyncapi/generator/lib/generator.js:224:21)
    at async Generator.generate (/home/niraj/Desktop/niraj/work-projects/lmu/lmu_portal_backend/node_modules/.pnpm/@asyncapi+generator@1.13.1_@types+node@20.11.24/node_modules/@asyncapi/generator/lib/generator.js:186:5)

These are my dependencies

"dependencies": {
    "@aws-sdk/client-cloudfront": "^3.525.0",
    "@aws-sdk/cloudfront-signer": "^3.523.0",
    "@nestjs/common": "^10.3.3",
    "@nestjs/core": "^10.3.3",
    "@nestjs/jwt": "^10.2.0",
    "@nestjs/passport": "^10.0.3",
    "@nestjs/platform-express": "^10.3.3",
    "@nestjs/platform-socket.io": "^10.3.3",
    "@nestjs/schedule": "^4.0.1",
    "@nestjs/swagger": "^7.3.0",
    "@nestjs/throttler": "^5.1.2",
    "@nestjs/typeorm": "^10.0.2",
    "@nestjs/websockets": "^10.3.3",
    "@types/node": "^20.11.24",
    "archiver": "^7.0.0",
    "argon2": "^0.40.1",
    "aws-sdk": "^2.1569.0",
    "axios": "^1.6.5",
    "body-parser": "^1.20.2",
    "class-transformer": "^0.5.1",
    "class-validator": "^0.14.0",
    "compression": "^1.7.4",
    "cookie-parser": "^1.4.6",
    "firebase-admin": "^12.0.0",
    "google-auth-library": "^9.6.3",
    "googleapis": "^133.0.0",
    "handlebars": "^4.7.7",
    "helmet": "^7.1.0",
    "hpp": "^0.2.3",
    "html-docx-js-typescript": "^0.1.5",
    "ioredis": "^5.3.2",
    "jsonwebtoken": "^9.0.2",
    "livekit-server-sdk": "^1.2.7",
    "lodash": "^4.17.21",
    "minio": "^7.1.1",
    "nestjs-asyncapi": "^1.3.0",
    "nestjs-fingerprint": "^1.0.4",
    "nodemailer": "^6.9.11",
    "openai": "^4.28.4",
    "passport": "^0.7.0",
    "passport-google-oauth20": "^2.0.0",
    "passport-jwt": "^4.0.0",
    "pg": "^8.7.3",
    "qrcode": "^1.5.3",
    "reflect-metadata": "^0.2.1",
    "rimraf": "^5.0.5",
    "rxjs": "^7.2.0",
    "sharp": "^0.33.2",
    "slugify": "^1.6.5",
    "socket.io": "^4.4.0",
    "speakeasy": "^2.0.0",
    "stripe": "^14.19.0",
    "swagger-ui-express": "^5.0.0",
    "typeorm": "^0.3.6",
    "uid": "^2.0.0",
    "ulid": "^2.3.0",
    "uuid": "^9.0.1",
    "winston": "^3.8.1",
    "xss-filters": "^1.2.7",
    "yarn": "^1.22.19"
  },
  "devDependencies": {
    "@nestjs/cli": "^10.3.2",
    "@nestjs/schematics": "^10.1.1",
    "@nestjs/testing": "^10.3.3",
    "@types/archiver": "^6.0.2",
    "@types/body-parser": "^1.19.2",
    "@types/compression": "^1.7.5",
    "@types/cookie-parser": "^1.4.7",
    "@types/express": "^4.17.13",
    "@types/jest": "29.5.12",
    "@types/multer": "^1.4.11",
    "@types/nodemailer": "^6.4.4",
    "@types/passport-google-oauth20": "^2.0.13",
    "@types/passport-jwt": "^4.0.1",
    "@types/speakeasy": "^2.0.10",
    "@types/supertest": "^6.0.2",
    "@types/uuid": "^9.0.8",
    "@typescript-eslint/eslint-plugin": "^7.1.0",
    "@typescript-eslint/parser": "^7.1.0",
    "eslint": "^8.57.0",
    "eslint-config-prettier": "^9.1.0",
    "eslint-plugin-prettier": "^5.1.3",
    "javascript-obfuscator": "^4.0.2",
    "jest": "29.7.0",
    "prettier": "^3.2.5",
    "source-map-support": "^0.5.20",
    "supertest": "^6.1.3",
    "ts-jest": "29.1.2",
    "ts-loader": "^9.2.3",
    "ts-node": "^10.9.1",
    "tsconfig-paths": "4.2.0",
    "typescript": "^5.3.3"
  }, 

Nest version: 10.3.3
"nestjs-asyncapi": "^1.3.0",

Am using pnpm, tried with yarn and npm. still same error

Copy link

github-actions bot commented Mar 1, 2024

Hello! Thank you for filing an issue.

If this is a bug report, please include relevant logs to help us debug the problem.

@flamewow
Copy link
Owner

flamewow commented Mar 3, 2024

Hi @kafle1, thank you for reporting the issue.
Can you please provide min reproduction repo for that issue?

@kafle1
Copy link
Author

kafle1 commented Mar 3, 2024

@flamewow, if i could provide you the reproduction step, i would also have solved the issue, but unfortunately couldnt find where is it coming from, temporarily fixed by commenting out all the @AsyncApiPub

@n0isy
Copy link

n0isy commented Mar 9, 2024

Same error on NestJS 10 + Fastify Platform

изображение

Dig some errors here

Ok. I comment auth, and lib starts now:

// .addBearerAuth(
//   {
//     type: "apiKey",
//     name: "Authorization",
//     in: "header",
//     description: "Access Token",
//   },
//   "access",
// )

@kafle1 Can you provide your setup code, please?

@kafle1
Copy link
Author

kafle1 commented Mar 10, 2024

const asyncApiOptions = new AsyncApiDocumentBuilder()
      .setTitle('Me Portal')
      .setDescription('test')
      .setVersion('1.0')
      .setDefaultContentType('application/json')
      .addSecurity('user-password', { type: 'userPassword' })
      .addServer('server', {
        url: BASE_URL.backend,
        protocol: 'socket.io',
        protocolVersion: '4',
        description: 'Allows you to connect using thewebsocket protocol to our socket.io server',
        security: [{ 'user-password': [] }],
        variables: {
          PORT: {
            description: 'Secure connection (TLS) is available through port 443',
            default: '443',
          },
        },
        bindings: {},
      })
      .build();

    const asyncapiDocument = AsyncApiModule.createDocument(app, asyncApiOptions);

    await AsyncApiModule.setup('/docs/socket', app, asyncapiDocument);

@n0isy

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

3 participants