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

Fetch Failed During Bundle Upload #922

Open
elian0ghost opened this issue Dec 11, 2024 · 4 comments
Open

Fetch Failed During Bundle Upload #922

elian0ghost opened this issue Dec 11, 2024 · 4 comments

Comments

@elian0ghost
Copy link

Issue Summary

Cannot upload bundle using npx @capgo/cli bundle upload from external machines

When trying to upload a bundle using the Capgo CLI from an external machine, the upload process fails during the upload step with the following error:

Failed to upload bundle ( after 19.10 seconds)
Cannot upload bundle ( try again with --tus option)
message: fetch failed
stack: 
-TypeError: fetch failed
    at node:internal/deps/undici/undici:13392:13
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async i (node_modules/@capgo/cli/dist/index.js:243:4805)
    at async t._retry (node_modules/@capgo/cli/dist/index.js:243:8760)
    ...

The upload works fine when run directly on the server hosting the Supabase instance. However, it consistently fails when executed from any external machine.

I have also tested this using:

A free online Supabase instance
Both Windows 11 and macOS as client machines
The result is the same across environments, suggesting the issue might not be platform-specific or tied to the self-hosted configuration.

Expected Behavior

The bundle should upload successfully from external machines using the npx @capgo/cli bundle upload command.

Actual Behavior

The CLI successfully reaches the encryption and checksum validation steps but fails during the upload process with a "fetch failed" error.

Steps to Reproduce

Configure the capacitor.config.json file as follows:

{
  "plugins": {
    "CapacitorUpdater": {
      "localApi": "https://X/api/",
      "statsUrl": "https://X/api/functions/v1/stats",
      "channelUrl": "https://X/api/functions/v1/channel_self",
      "updateUrl": "https://X/api/functions/v1/updates",
      "localSupa": "https://X/api",
      "localSupaAnon": "your_anon_key"
    }
  }
}

Run npx @capgo/cli bundle upload from an external machine (Windows/macOS).
Observe the error during the upload process.
Nginx Configuration
If relevant, here’s the Nginx configuration for the self-hosted instance:

# Capgo Server Block
server {
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name X;

    # SSL Configuration
    ssl_certificate /etc/nginx/ssl/capgo.pem;
    ssl_certificate_key /etc/nginx/ssl/private.key;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers HIGH:!aNULL:!MD5;

    # Frontend Configuration
    root /var/www/capgo;
    index index.html;

    location / {
        try_files $uri /index.html;
    }

    # API and Functions Proxies
    location /api/ {
        proxy_pass http://127.0.0.1:54321/;
    }
    location /fn/v1/ {
        proxy_pass http://127.0.0.1:54321/functions/v1/;
    }

    # Storage Proxy
    location /storage/ {
        proxy_pass http://127.0.0.1:54321/storage/;
        client_max_body_size 1000M;
        proxy_request_buffering off;
    }

    # Redirect HTTP to HTTPS
    server {
        listen 80;
        return 301 https://$host$request_uri;
    }
}

Questions

  • Could this issue be related to TUS protocol or large bundle uploads?
  • Are there additional configurations required for the Capgo CLI when used on external networks?
  • Can someone help debug this issue further? Are there specific logs or debugging steps I can provide?

Environment Details

CLI Version: @capgo/cli v4.26.11
Operating Systems Tested: Windows 11, macOS
Supabase Backend: Tested with both self-hosted and free online instance
If you need more details or want me to run additional tests, please let me know. Thank you for your help!

@riderx
Copy link
Contributor

riderx commented Dec 12, 2024

Can you curl to https://X/api/functions/v1/ok ?
if yes try to open the logs of the egde container maybe you will find the issue there

@riderx
Copy link
Contributor

riderx commented Dec 12, 2024

Honestly i never used self host as we use cloud supabase, so hard for me to help. free instance of supabase cloud are not allowing enouth i think for capgo to work on them

@elian0ghost
Copy link
Author

@riderx no errors othere than those

[Error] warning: Use of deprecated "Deno.stderr.rid" API. This API will be removed in Deno 2. Run again with DENO_VERBOSE_WARNINGS=1 to get more details.

[Error] warning: Use of deprecated "Deno.stdout.rid" API. This API will be removed in Deno 2. Run again with DENO_VERBOSE_WARNINGS=1 to get more details.

[Error] warning: Use of deprecated "Deno.stdin.rid" API. This API will be removed in Deno 2. Run again with DENO_VERBOSE_WARNINGS=1 to get more details.

@Martos
Copy link

Martos commented Dec 20, 2024

I have the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants