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

[bug]: Empty response for node-fetch http call #376

Closed
1 task done
re-Tick opened this issue Feb 27, 2023 · 17 comments · Fixed by keploy/typescript-sdk#60 · May be fixed by keploy/typescript-sdk#58 or keploy/typescript-sdk#72
Closed
1 task done

[bug]: Empty response for node-fetch http call #376

re-Tick opened this issue Feb 27, 2023 · 17 comments · Fixed by keploy/typescript-sdk#60 · May be fixed by keploy/typescript-sdk#58 or keploy/typescript-sdk#72
Labels
bug Something isn't working Good First Issue Good for newcomers GSoC Issues up for GSoC Repo/@typescript-sdk Issue Related to Keploy TS-SDK Repository

Comments

@re-Tick
Copy link
Contributor

re-Tick commented Feb 27, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

When I do a node-fetch call after integrating keploy/typescript, the response is not the expected result from that API. It can be due to intercepting the node-fetch API calls.

Steps to reproduce

  1. Run the Keploy server.
  2. Integrate the node-fetch with Keploy's TS-SDK to mock dependencies of your sample API.
  3. Run your sample API on "off" mode
  4. Curl the endpoint which making node-fetch call to "https://api.keploy.io/healthz" and logging that response.
    Hence, you can see that node-fetch is returning empty Response instead of {status:200, body:"ok"}.

Environment

None

Version

Self-hosted

@re-Tick re-Tick added bug Something isn't working Good First Issue Good for newcomers labels Feb 27, 2023
@Ramanjs
Copy link

Ramanjs commented Feb 27, 2023

Hi, I want to work on this issue.

@Ramanjs
Copy link

Ramanjs commented Feb 27, 2023

I tried to reproduce this bug on the node-fetch sample program by setting KEPLOY_MODE=off, and it's returning the complete response object with the correct status code and message. Can you describe your step 2 a bit more elaborately so I can better understand how to reproduce the bug? Thanks.

@re-Tick
Copy link
Contributor Author

re-Tick commented Feb 28, 2023

Hi @Ramanjs, the problem is that I have not integrated the express hook in my local application. Hence, when you comment the require hook for express in node-fetch/server.js, then the application will crash with this message in screenshot
Screenshot 2023-02-28 at 12 24 53 PM

@Sonichigo Sonichigo added GSoC Issues up for GSoC Repo/@typescript-sdk Issue Related to Keploy TS-SDK Repository labels Feb 28, 2023
@Sonichigo Sonichigo transferred this issue from keploy/typescript-sdk Mar 3, 2023
@kartikvirendrar
Copy link

Hello @re-Tick I am interested to work on this issue

@shreyanshshah27
Copy link

Hey @re-Tick I was trying to reproduce this issue. But even for me this is working fine. It would be really helpful if you can add precise instructions on how to reproduce this bug.

@re-Tick
Copy link
Contributor Author

re-Tick commented Mar 6, 2023

Steps to reproduce this is:

  1. Install the sample application for TS-SDK. here
  2. Comment this line and restart the sample application.
  3. Now try doing the curl request to sample application.

@shreyanshshah27
Copy link

@re-Tick Thanks for providing this info. I'm now able to reproduce the bug and I think I've understood the issue. I'll soon create a PR for this.

@Ramanjs
Copy link

Ramanjs commented Mar 6, 2023

Hi @re-Tick, the server crashes for all modes, not just when it is off. I am a bit confused about the expected result of this issue. The node-fetch module depends upon the middleware introduced by the express hook to generate and store test cases and their mocks and deps. If I use node-fetch alone, no mocks will be generated since there is no Keploy object and no context either. It would be amazing if you could clarify how this thing works and let me know if Im approaching this wrong. Thanks!

@re-Tick
Copy link
Contributor Author

re-Tick commented Mar 7, 2023

Hi @re-Tick, the server crashes for all modes, not just when it is off. I am a bit confused about the expected result of this issue. The node-fetch module depends upon the middleware introduced by the express hook to generate and store test cases and their mocks and deps. If I use node-fetch alone, no mocks will be generated since there is no Keploy object and no context either. It would be amazing if you could clarify how this thing works and let me know if Im approaching this wrong. Thanks!

Yes, you got this right @Ramanjs. The expected behaviour should that no test/mocks are generated because of missing express integration. But it should make the actual call to node-fetch which is currently missing.

@Shaurya-Developer
Copy link

Can I work on this issue?

@re-Tick
Copy link
Contributor Author

re-Tick commented Mar 8, 2023

Hi @Shaurya-Developer, please make your changes and open a PR. Ans mention the PR in the Gsoc/2023 ts-sdk task list.

@Shaurya-Developer
Copy link

Okay, @re-Tic. And what I'm supposed to write in PR? “Solved #376 Gsoc/2023 ts-sdk” is this alright?

@re-Tick
Copy link
Contributor Author

re-Tick commented Mar 8, 2023

Okay, @re-Tic. And what I'm supposed to write in PR? “Solved #376 Gsoc/2023 ts-sdk” is this alright?

Mention this issue and your changes in your PR and provide the link of PR in TS-SDK task list

@Shaurya-Developer
Copy link

Okay, @re-Tic. And what I'm supposed to write in PR? “Solved #376 Gsoc/2023 ts-sdk” is this alright?

Mention this issue and your changes in your PR and provide the link of PR in TS-SDK task list

Alright, Thanks

@VishalMyla
Copy link

Please Assign this issue to me

@re-Tick
Copy link
Contributor Author

re-Tick commented Mar 24, 2023

Hi @VishalMyla, the issues are open for all. Please feel free to discuse your changes here or make your PR.

@VishalMyla
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Good First Issue Good for newcomers GSoC Issues up for GSoC Repo/@typescript-sdk Issue Related to Keploy TS-SDK Repository
Projects
None yet
7 participants