Skip to content

Running in Heroku (Empty swagger.json) #42

@D40298008

Description

@D40298008

I stood up a starter Adonis5 application (API) and I'm trying to get it to run in production on Heroku. As a temporary workaround, I hard coded mode: 'RUNTIME' inside of swagger.ts. This seemed to work fine and I could see my one controller's docs just fine. Of course, I have since put this back.

First, I ran into this issue: #41

  • Commenting out PORT and APP_NAME worked for me (in env.ts).

Then, I ran into this issue: #33

  • Creating a /docs folder with a /docs/.keep finally made the build successful.

However, now my docs have all disappeared. The swagger page shows this error: No operations defined in spec! and my swagger.json file appears to have been built like this:

{"openapi":"3.0.0","info":{"title":"My Adonis5 App","version":"1.0.0"},"paths":{},"components":{},"tags":[]}

I checked the server and both files were built this way...the one in /docs/swagger.json and then the one that got copied to /build/docs/swagger.json.

As per the instructions (https://github.com/reg2005/adonis5-swagger#production-using) my package.json file has the postbuild script:

"build"     : "node ace build --production",
"postbuild" : "node ace swagger:generate && cp -a docs/ build/docs",

My versions:

adonis5-swagger : 1.4.1
node : 20.2.0

If I run node ace swagger:generate locally, it creates the proper /docs/swagger.json file. Any idea why it's empty in production?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions