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

Glee crashes when body is not proper json in http request #476

Open
KhudaDad414 opened this issue Jul 10, 2023 · 19 comments
Open

Glee crashes when body is not proper json in http request #476

KhudaDad414 opened this issue Jul 10, 2023 · 19 comments
Labels
area/typescript Specify what technical area given issue relates to. Its goal is to ease filtering good first issues. bug Something isn't working good first issue Good for newcomers

Comments

@KhudaDad414
Copy link
Member

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 KhudaDad414 added the bug Something isn't working label Jul 10, 2023
@asyncapi-bot asyncapi-bot added area/typescript Specify what technical area given issue relates to. Its goal is to ease filtering good first issues. good first issue Good for newcomers labels Jul 10, 2023
@SrijanShovit
Copy link

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

@KhudaDad414
Copy link
Member Author

@SrijanShovit go ahead mate. just let me know if you needed some help. 😄

@SrijanShovit
Copy link

Hey I tried setting up, but got confused how to run the project😅

@Souvikns
Copy link
Member

Souvikns commented Aug 9, 2023

@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
    "@asyncapi/glee": "file:../.."

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

@SrijanShovit
Copy link

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!!

@KhudaDad414
Copy link
Member Author

@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.

@peter-rr
Copy link
Member

@KhudaDad414 @SrijanShovit Working fine for me after following those steps 👍
(Glee version tested: 0.26.0)

@Souvikns
Copy link
Member

Souvikns commented Oct 3, 2023

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

@AnishKacham
Copy link

Hi. I can work on this if no one's assigned 😅

@KhudaDad414
Copy link
Member Author

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

@Gmin2
Copy link

Gmin2 commented Jan 21, 2024

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
Copy link

Gmin2 commented Jan 21, 2024

@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
    "@asyncapi/glee": "file:../.."

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

@KhudaDad414
Copy link
Member Author

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

@Gmin2
Copy link

Gmin2 commented Feb 10, 2024

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

It is giving this error now

image

@peter-rr
Copy link
Member

peter-rr commented Apr 12, 2024

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

@KhudaDad414
Copy link
Member Author

@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.

@peter-rr
Copy link
Member

@KhudaDad414
Great! Let me change the sendTrigger/messages then 👍
I guess the asyncapi file @utnim2 has been using is the following one:

- $ref: "#/components/messages/string"

@peter-rr
Copy link
Member

@KhudaDad414 Working correctly now after changing the operation messages as you mentioned above. I've opened a PR to fix that issue: #805

@KhudaDad414
Copy link
Member Author

@peter-rr merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/typescript Specify what technical area given issue relates to. Its goal is to ease filtering good first issues. bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

7 participants