Skip to content

Relay fails after ~30-40% quota consumed — apps_script timeouts, full tunnel also dead #877

Closed

Description

@Montazeran8

Environment

  • mhrv-rs version: v1.9.17
  • OS: Windows 10
  • ISP: ADSL (Mokhaberat Iran)

Problem Description

The relay works normally for some time after a fresh deployment, but after consuming approximately 30–40% of the daily UrlFetchApp quota, it starts failing consistently with 502/504 errors. This happens in both apps_script mode and full mode (ngrok tunnel).

apps_script mode behavior:

  • Initially passes end-to-end test (200 OK).
  • After moderate usage, every relay request returns:
    HTTP/1.1 502 Bad Gateway
    Relay error: timeout
    
  • Even simple HTTP POSTs to Telegram’s API (149.154.*.*) fail with the same timeout error.

full mode (ngrok) behavior:

  • Tunnel establishes correctly, but soon every batch operation times out:
    WARN batch failed (script …): timeout
    ERROR tunnel connect_data error … : timeout
    
  • The script is rapidly blacklisted after 3 timeouts in 30 seconds, making the tunnel unusable.

Suspected Cause

The daily quota on my account appears to be around 10,000 requests (half of the documented 20,000), which means I hit the limit much earlier than expected. This explains why the relay works initially but dies after moderate usage.

Impact

This makes the relay unreliable for any real work. I have to rebuild the relay frequently just to get a few hours of usable connectivity.

Request

Is there a known issue with lower quota for certain Google accounts (e.g., accounts created from Iran)? Could this be a regional restriction? Any workaround to increase the effective quota (beyond multiple script_ids) would be appreciated.

Activity

  1. Montazeran8 commented on May 7, 2026

    @Montazeran8
    Author

    Minor note on parallel_concurrency: I manually add "parallel_concurrency": 10 to config.json, but any UI save removes it. Meanwhile, "force_http1": true also added manually persists fine. Is this intentional?

  2. Montazeran8 commented on May 7, 2026

    @Montazeran8
    Author

    Documentation bug in ngrok.md: Step 8 says "Use mhrv-rs test or visit https://ipleak.net". But in full mode, mhrv-rs test refuses to run and prints:

    > `mhrv-rs test` is wired only for the apps_script relay path…
    

    The actual tool output explicitly says the command can't be used for full mode verification. The doc should instead point only to https://whatismyipaddress.com (or ipleak.net) via the proxy, as the tool itself advises.

  3. Montazeran8 commented on May 7, 2026

    @Montazeran8
    Author

    Documentation note: In the Renewing the Tunnel section, step 4 says the tunnel URL "changes each time". I've run the workflow three times now and the URL remains the same (static). I'm on the ngrok free tier. Is this expected or should the docs be adjusted? It might cause confusion if users expect a new URL every run.

  4. Montazeran8 commented on May 7, 2026

    @Montazeran8
    Author

    Documentation note re: ngrok URL behavior:
    The Limitations and Available Methods section says ngrok's URL "changes on restart" and must be updated each time. In practice, my ngrok URL stays the same across multiple runs (likely because ngrok's free tier now includes a static domain). The doc’s instruction to re‑deploy CodeFull.gs each session is therefore unnecessary and may confuse users. Could this be updated?

  5. therealaleph commented on May 7, 2026

    @therealaleph
    Owner

    Reviewed via Anthropic Claude. Thanks for the detailed report — addressing each point:

    1. Quota fail at ~30-40% (apps_script + full mode both die)
    The 502/timeout pattern + urlfetch quota error in @Morrigan-Ship's #872 are the same root cause: Apps Script daily quota exhausted. Yes, accounts created from Iran consistently get a lower bucket — anecdotally 5K-10K UrlFetch calls/day vs the documented 20K. Google doesn't publish the per-region split.

    The "both modes die at the same time" is consistent: full mode also burns Apps Script's UrlFetch quota for outbound from CodeFull.gs to the tunnel (each batch poll = 1 fetch() call from Apps Script's side). When the daily UrlFetch quota is hit, both modes go down together.

    Workarounds:

    • Add 3-5 script_id entries (each from a different Google account) to config.json. mhrv-rs round-robins.
    • For full mode specifically: each script_id deployment = 1 separate quota bucket.

    2. parallel_concurrency: 10 stripped on UI save
    That field doesn't exist in mhrv-rs config — that's why the UI strips it (any unknown field is dropped on round-trip through the typed ConfigWire struct). The closest real field is parallel_relay (clamped to N script IDs). force_http1 persists because it IS a real field. So this is working as designed, but the silent strip is bad UX — I'll think about whether to log a warning on unknown keys.

    3. mhrv-rs test fails in full mode (ngrok.md Step 8)
    Real doc bug. Fixed in [b... commit] — Step 8 now tells users to use ipleak.net/whatismyipaddress.com for full-mode verification, since mhrv-rs test is wired only for the apps_script path.

    4. ngrok URL static across runs
    You're right — ngrok's free tier now ships with a default static domain. The doc was written before that change. Updated:

    • ngrok.md: "Renewing the Tunnel" + "Limitations" sections now distinguish static-domain accounts (no redeploy needed) from older accounts that opted out.
    • README.md: updated to mention only Method 1 (cloudflared Quick) has truly volatile URLs.

    Closing #877. The quota issue (#1) is account-side and the doc issues (#3, #4) are now fixed. If you want the per-script-ID quota observed, file a feature request — adding a /quota endpoint to Code.gs that calls UrlFetchApp.getRemainingDailyQuota() could show the bucket size up front.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions