glee icon indicating copy to clipboard operation
glee copied to clipboard

Glee crashes when body is not proper json in http request

Open KhudaDad414 opened this issue 2 years ago β€’ 21 comments

Reason/Context

If the the request body does not contain proper json as glee expects, it will crush with the following error: Screenshot 2023-07-10 at 17 13 00

Expected behaviour

  1. check if user's HTTP request is documented in AsyncAPI file, if it is not, then show proper message on server console and send a 404 error to the client.

  2. Glee should show a proper message instead of crushing if proper json is not passed to by the client.

KhudaDad414 avatar Jul 10 '23 16:07 KhudaDad414

Hi @KhudaDad414 I would like to take up this issue. Right now I am trying to setup things. Thanks!!

SrijanShovit avatar Aug 06 '23 12:08 SrijanShovit

@SrijanShovit go ahead mate. just let me know if you needed some help. πŸ˜„

KhudaDad414 avatar Aug 08 '23 17:08 KhudaDad414

Hey I tried setting up, but got confused how to run the projectπŸ˜…

SrijanShovit avatar Aug 09 '23 10:08 SrijanShovit

@SrijanShovit to run the project:

  • Fork and clone to project to your local machine
  • then install the required dependencies by running npm i
  • then build the project by running npm run build, once this command is successfully run you will see a dist folder in your working directory.
  • Now you can go to the examples in the example folder and run them by first installing the dependency and then npm run start
  • or you can create a new example to tests what you want just add the local build as a dependency https://github.com/asyncapi/glee/blob/b0f55a6f83e02cb3004621331fba95968f91f553/examples/dummy/package.json#L13

I hope this helps, if it does not feel free to share which step you are stuck with.

Souvikns avatar Aug 09 '23 11:08 Souvikns

Hi @KhudaDad414 @Souvikns , I tried to run the project as per the steps told above,but got the following error: async api

I tried understanding about the error, but as I am new , I couldn't. Could you please guide about it and also may I have an overview of flow or architecture of this project? Thanks!!

SrijanShovit avatar Aug 10 '23 07:08 SrijanShovit

@SrijanShovit the error should be gone now. please delete you .glee folder and update your glee to the latest version. after that run npm run dev and it should be fine.

KhudaDad414 avatar Aug 14 '23 08:08 KhudaDad414

@KhudaDad414 @SrijanShovit Working fine for me after following those steps πŸ‘ (Glee version tested: 0.26.0)

peter-rr avatar Aug 23 '23 12:08 peter-rr

Is anyone working on this, should we put this issue for hacktoberfest?

Souvikns avatar Oct 03 '23 02:10 Souvikns

Hi. I can work on this if no one's assigned πŸ˜…

AnishKacham avatar Oct 24 '23 11:10 AnishKacham

Hi @AnishKacham, you can start working on the issue. please let me know if you need some help.

KhudaDad414 avatar Nov 02 '23 12:11 KhudaDad414

working on this when i try to run the http-test example it is generating this error,localhost:3000 is not spinning up image

cc @KhudaDad414 @Souvikns

Gmin2 avatar Jan 21 '24 13:01 Gmin2

@SrijanShovit to run the project:

  • Fork and clone to project to your local machine
  • then install the required dependencies by running npm i
  • then build the project by running npm run build, once this command is successfully run you will see a dist folder in your working directory.
  • Now you can go to the examples in the example folder and run them by first installing the dependency and then npm run start
  • or you can create a new example to tests what you want just add the local build as a dependency https://github.com/asyncapi/glee/blob/b0f55a6f83e02cb3004621331fba95968f91f553/examples/dummy/package.json#L13

I hope this helps, if it does not feel free to share which step you are stuck with.

Followed this guide for it

cc @KhudaDad414 @Souvikns

Gmin2 avatar Jan 21 '24 13:01 Gmin2

@Min2who the issue has been resolved. please try with the latest version.

KhudaDad414 avatar Jan 23 '24 11:01 KhudaDad414

@Min2who the issue has been resolved. please try with the latest version.

It is giving this error now

image

Gmin2 avatar Feb 10 '24 20:02 Gmin2

It is giving this error now

Still getting the same error. Seems like there is some conflict at sendTrigger operation when parsing the spec file πŸ€”

image

Glee version tested: 0.36.14

cc @KhudaDad414 @Souvikns

peter-rr avatar Apr 12 '24 18:04 peter-rr

@peter-rr your AsyncAPI file is not valid. As it should have been said in the error, messages in operation should point to messages in their respective channels. sendTrigger/messages should be something like:

messages:
  - $ref: "#/channels/TRIGGER/messages/string"

@utnim2 I don't see your asyncapi file but I think your issue is the same.

KhudaDad414 avatar Apr 15 '24 15:04 KhudaDad414

@KhudaDad414 Great! Let me change the sendTrigger/messages then πŸ‘ I guess the asyncapi file @utnim2 has been using is the following one: https://github.com/asyncapi/glee/blob/ed66e843ea1305a5823f7e4bd98503b57dd72607/examples/http-test/asyncapi.yaml#L49

peter-rr avatar Apr 15 '24 15:04 peter-rr

@KhudaDad414 Working correctly now after changing the operation messages as you mentioned above. I've opened a PR to fix that issue: https://github.com/asyncapi/glee/pull/805

peter-rr avatar Apr 15 '24 16:04 peter-rr

@peter-rr merged.

KhudaDad414 avatar Apr 17 '24 17:04 KhudaDad414

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 Aug 16 '24 00:08 github-actions[bot]