nodejs-template icon indicating copy to clipboard operation
nodejs-template copied to clipboard

[BUG] Generated Dockerfile runs a non-existing npm command

Open nightknighto opened this issue 11 months ago • 2 comments

Describe the bug.

In the generated Dockerfile, the CMD is set to npm start. There are no npm scripts defined at all in the generated package.json, thus it leads to an error when running the container.

Expected behavior

The docker container should run successfully and start the server.

Screenshots

Error: Image

Dockerfile: Image

package.json: Image

How to Reproduce

  1. Generate the tutorial's asyncapi yaml file from CLI
  2. Generate the nodejs template
  3. Check package.json and Dockerfile, or try to build and run the image.

🖥️ Device Information [optional]

👀 Have you checked for similar open issues?

  • [x] I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

Yes I am willing to submit a PR!

nightknighto avatar Mar 20 '25 23:03 nightknighto

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

github-actions[bot] avatar Mar 20 '25 23:03 github-actions[bot]

@derberg There is no file that starts the server, so I suggest adding a server.js under src that has the bootstrapping code to start the server and optionally provide example on how to use each function. I understand that the generated template is designed as SDK not standalone, but the user can simply ignore this file if they wish, while it will provide an example and be useful if someone is trying out (and give something for Docker to run).

If the suggestion is accepted, I can work on it

nightknighto avatar Mar 21 '25 00:03 nightknighto

This issue has been automatically marked as stale because it has not had recent activity :sleeping:

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience :heart:

github-actions[bot] avatar Jul 20 '25 00:07 github-actions[bot]