10000 [bug]:The desktop application cannot access the local API. · Issue #5003 · hoppscotch/hoppscotch · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[bug]:The desktop application cannot access the local API. #5003

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

Open
1 task done
shixing2 opened this issue Apr 17, 2025 · 9 comments
Open
1 task done

[bug]:The desktop application cannot access the local API. #5003

shixing2 opened this issue Apr 17, 2025 · 9 comments
Labels
bug Something isn't working need testing Needs to be tested before merging onto production

Comments

@shixing2
Copy link

Is there an existing issue for this?

  • I have searched existing issues and this bug hasn't been reported yet

Current behavior

In Windows 11, I want to access the local api, but it doesn't work. None of the options are working.

Steps to reproduce

Image

Logs and Screenshots

Environment

Production

Hoppscotch Version

Local

Interceptor

Native - Desktop App

Browsers Affected

Not applicable (Desktop app)

Operating System

Windows

Additional Information

No response

@shixing2 shixing2 added bug Something isn't working need testing Needs to be tested before merging onto production labels Apr 17, 2025
@shixing2
Copy link
Author

Image

@CuriousCorrelation
Copy link
Member

Hi @shixing2, could you please add a title for the bug report that summarizes the situation you are experiencing? Empty titles are difficult to track.

As I understand, you appear to be using both Hoppscotch Desktop app and Hoppscotch Agent simultaneously, which isn't the intended configuration. The Hoppscotch Agent is specifically designed to work with the Hoppscotch Web app, not the desktop app. The desktop app already has built-in capabilities via “Native” interceptor that make the Agent unnecessary. The docs provide a great walkthrough on these distributions.

I also notice you're trying to use a proxy to connect to the endpoint, but the proxy field appears to be empty in your settings page screenshot. If you don't actually need to proxy the requests, it is recommended to disable this option using the toggle shown above the field.

I'm also seeing that you aren't connecting to a local server but rather a server hosted on a domain, so unsure as to what you meant by "access to local api".

Could you clarify these with some more details about what you're specifically trying to accomplish? This would help a lot in determining the exact issue. Thanks!

@shixing2 shixing2 changed the title [bug]: [bug]:The desktop application cannot access the local API. Apr 17, 2025
@shixing2
Copy link
Author

desktop application cannot access the local API.
the same API can be successfully requested in Google Chrome.
What configuration is causing this issue?

Image

Image

@CuriousCorrelation
Copy link
Member

Thanks for the update. The settings seems to be set correctly, although status code 502 can sometimes mean an issue with domain resolution. Could you please check if the generated cURL request is able to correctly connect to the server?

Here's an example of a GET request to https://echo.hoppscotch.io
Image

Image

@shixing2
Copy link
Author

test result.

Image

Google Chrome request result

Image

test results using other tools

Image

@CuriousCorrelation
Copy link
Member
CuriousCorrelation commented Apr 17, 2025

Thanks for running the diagnostics! This doesn't appear to be a resolution issue, let's investigate how the request is being handled differently between the two clients.

Could you help me:

  1. By sharing the request body you're using? Feel free to anonymize any sensitive data if required.
  2. Or even better, could you try making a test request to our echo server at https://echo.hoppscotch.io using both Web app and the desktop app with identical parameters and sharing the response? This would help a lot to understand the differences in how requests are being formed, transmitted and received. You can simply change the URL and keep everything as is to run this test.

@shixing2
Copy link
Author
shixing2 commented Apr 18, 2025

Thank you, please see the test results.

Image

Image

Image

@CuriousCorrelation
Copy link
Member

Hi @shixing2, thanks for the info!

I’m finding it a bit difficult to replicate this on my machine, even with setting up a local server with custom host files. All requests seems to be going through correctly. So perhaps this is an environment specific issue that is affecting native request calls.

The 502 Bad Gateway in some cases points to an internal proxy/gateway in the app's communication path still, where it’s receiving invalid response from an upstream server.
A workaround to try first would be using the direct IP address instead of the domain name, like so http://192.168.174.133:80/credit/v2/creditApply which might bypass potential domain handling issues.

No worries if that doesn't work, I'm working on a log rotation system for the desktop app that will provide much better insights into the communication path. This should be available in one of the upcoming releases and will definitely accelerate diagnosis of issues like this in the future.

CuriousCorrelation added a commit that referenced this issue Apr 21, 2025
This PR adds a file-based logging system with size-based rotation
to the desktop application. It essentially redirects existing diagnostic
to size-based rotating files for troubleshooting environment-specific issues.

Closes HFE-805

The desktop application currently lacks a persistent logging mechanism
in production environments. Logs are only available through the development
mode console.

This PR will help diagnose issues reported in #4859, #4950, #5003,
discussions #4984 and #4986.

Mainly aiming to understand errors in specific environments
that can't be reproduced in our testing setups.

This implementation uses the tracing ecosystem (`tracing`, `tracing_subscriber`,
`tracing_appender`) along with `file_rotate` to create log files in the
platform's log directory. The logs are automatically rotated
when they reach `10MB`, with a maximum of `5` files retained.

Thinking 10 * 5 MB is reasonable disk usage while maintaining sufficient history.

The system currently writes to both the console (with ANSI colors where supported)
and to files (without ANSI formatting for readability). Log levels are
currently controlled via the `RUST_LOG` environment variable, defaulting to "debug"
when not specified.

| OS      | Log File Path                                        |
|---------|------------------------------------------------------|
| Windows | `C:\Users\<username>\AppData\Local\io.hoppscotch.desktop\logs\io.hoppscotch.desktop.log` |
| macOS   | `~/Library/Logs/io.hoppscotch.desktop/io.hoppscotch.desktop.log` |
| Linux   | `~/.local/share/io.hoppscotch.desktop/logs/io.hoppscotch.desktop.log` |
CuriousCorrelation added a commit that referenced this issue Apr 21, 2025
This PR adds a file-based logging system with size-based rotation to the desktop application. It essentially redirects existing diagnostic to size-based rotating files for troubleshooting environment-specific issues.

Closes HFE-801

The desktop a
8000
pplication currently lacks a persistent logging mechanism in production environments. Logs are only available through the development mode console.

This PR will help diagnose issues reported in #4859, #4950, #5003, discussions #4984 and #4986.

Mainly aiming to understand errors in specific environments that can't be reproduced in our testing setups.

This implementation uses the tracing ecosystem (`tracing`, `tracing_subscriber`, `tracing_appender`) along with `file_rotate` to create log files in the platform's log directory. The logs are automatically rotated when they reach `10MB`, with a maximum of `5` files retained.

Thinking 10 * 5 MB is reasonable disk usage while maintaining sufficient history.

The system currently writes to both the console (with ANSI colors where supported) and to files (without ANSI formatting for readability). Log levels are currently controlled via the `RUST_LOG` environment variable, defaulting to "debug" when not specified.

| OS      | Log File Path                                        |
|---------|------------------------------------------------------|
| Windows | `C:\Users\<username>\AppData\Local\io.hoppscotch.desktop\logs\io.hoppscotch.desktop.log` |
| macOS   | `~/Library/Logs/io.hoppscotch.desktop/io.hoppscotch.desktop.log` |
| Linux   | `~/.local/share/io.hoppscotch.desktop/logs/io.hoppscotch.desktop.log` |
CuriousCorrelation added a commit that referenced this issue Apr 25, 2025
This PR adds a file-based logging system with size-based rotation to the desktop application. It essentially redirects existing diagnostic to size-based rotating files for troubleshooting environment-specific issues.

Closes HFE-801

The desktop application currently lacks a persistent logging mechanism in production environments. Logs are only available through the development mode console.

This PR will help diagnose issues reported in #4859, #4950, #5003, discussions #4984 and #4986.

Mainly aiming to understand errors in specific environments that can't be reproduced in our testing setups.

This implementation uses the tracing ecosystem (`tracing`, `tracing_subscriber`, `tracing_appender`) along with `file_rotate` to create log files in the platform's log directory. The logs are automatically rotated when they reach `10MB`, with a maximum of `5` files retained.

Thinking 10 * 5 MB is reasonable disk usage while maintaining sufficient history.

The system currently writes to both the console (with ANSI colors where supported) and to files (without ANSI formatting for readability). Log levels are currently controlled via the `RUST_LOG` environment variable, defaulting to "debug" when not specified.

| OS      | Log File Path                                        |
|---------|------------------------------------------------------|
| Windows | `C:\Users\<username>\AppData\Local\io.hoppscotch.desktop\logs\io.hoppscotch.desktop.log` |
| macOS   | `~/Library/Logs/io.hoppscotch.desktop/io.hoppscotch.desktop.log` |
| Linux   | `~/.local/share/io.hoppscotch.desktop/logs/io.hoppscotch.desktop.log` |
AndrewBastin pushed a commit that referenced this issue Apr 25, 2025
This PR adds a file-based logging system with size-based rotation to the desktop application. It essentially redirects existing diagnostic to size-based rotating files for troubleshooting environment-specific issues.

Closes HFE-801

The desktop application currently lacks a persistent logging mechanism in production environments. Logs are only available through the development mode console.

This PR will help diagnose issues reported in #4859, #4950, #5003, discussions #4984 and #4986.

Mainly aiming to understand errors in specific environments that can't be reproduced in our testing setups.

This implementation uses the tracing ecosystem (`tracing`, `tracing_subscriber`, `tracing_appender`) along with `file_rotate` to create log files in the platform's log directory. The logs are automatically rotated when they reach `10MB`, with a maximum of `5` files retained.

Thinking 10 * 5 MB is reasonable disk usage while maintaining sufficient history.

The system currently writes to both the console (with ANSI colors where supported) and to files (without ANSI formatting for readability). Log levels are currently controlled via the `RUST_LOG` environment variable, defaulting to "debug" when not specified.

| OS      | Log File Path                                        |
|---------|------------------------------------------------------|
| Windows | `C:\Users\<username>\AppData\Local\io.hoppscotch.desktop\logs\io.hoppscotch.desktop.log` |
| macOS   | `~/Library/Logs/io.hoppscotch.desktop/io.hoppscotch.desktop.log` |
| Linux   | `~/.local/share/io.hoppscotch.desktop/logs/io.hoppscotch.desktop.log` |
@CuriousCorrelation
Copy link
Member

Hello @shixing2, the latest update for the desktop app (v25.4.0) now includes file-based rotating logs, a feature specifically implemented to help diagnose environment-specific issues like the one you were experiencing.

If you're still experiencing this issue after trying the IP address workaround, please update to the latest version (v25.4.0) and if you can, share your anonymized logs here.

The log files are located at:

  • Windows: C:\Users\<username>\AppData\Local\io.hoppscotch.desktop\logs\io.hoppscotch.desktop.log
  • macOS: ~/Library/Logs/io.hoppscotch.desktop/io.hoppscotch.desktop.log
  • Linux: ~/.local/share/io.hoppscotch.desktop/logs/io.hoppscotch.desktop.log

For more info on this logging feature, see PR #5009

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need testing Needs to be tested before merging onto production
Projects
None yet
Development

No branches or pull requests

2 participants
0