Windy Community
    • Unread
    • Categories
    • Groups
    • Go to windy.com
    • Register
    • Login

    Private plugin upload: always HTTP 415 on /plugins/v1.0/upload

    Scheduled Pinned Locked Moved Windy Plugins
    3 Posts 2 Posters 197 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • FRA915F Offline
      FRA915 | Premium
      last edited by

      Hello,

      I'm trying to publish a private plugin (Svelte, built with the official windy-plugin-template) through the upload API, from a GitHub Action:

      curl -XPOST 'https://node.windy.com/plugins/v1.0/upload'
      -H "x-windy-api-key: "
      -F "plugin_archive=@plugin.tar"

      The key is a "Plugins" service key and seems to be accepted, but every upload returns HTTP 415 Unsupported Media Type. I tried 11 variants, all with the same 415:

      • tar formats: GNU (Ubuntu default), POSIX ustar and pax;
      • archive contents: plugin.json + plugin.js + plugin.js.map + plugin.min.js + package.json, and a minimal one (plugin.json + plugin.min.js);
      • attachment type: guessed by curl (application/octet-stream), application/x-tar, application/tar.

      Could you tell me what the endpoint expects exactly: form field name, content type, archive format (tar, tar.gz, zip?) and the expected file layout inside the archive? An example of a working upload command would be perfect.

      The plugin works fine in developer mode (https://localhost:9999/plugin.js).

      Thanks!

      FRA915F 1 Reply Last reply Reply Quote 0
      • FRA915F Offline
        FRA915 @FRA915 | Premium
        last edited by

        Update: I ran 18 upload variants, all with the same "Plugins" API key, and every one gets "HTTP 415 Unsupported Media Type" with no other detail, in ~0.15 s:

        • multipart field plugin_archive with tar (GNU, ustar, pax), tar.gz and zip, with and without explicit type;
        • raw body (no multipart) with Content-Type application/x-tar, application/octet-stream, and application/gzip;
        • the exact command of the official windy-plugin-template (dist folder with plugin.json, plugin.min.js and screenshot.jpg).
          An invalid key gets 401, so the key itself seems recognised. Since the archive format and the request form make no difference, could you check whether my account (FRA915) or my key is allowed to upload plugins, or whether something is wrong on the server side? Thanks!
        brodiejB 1 Reply Last reply Reply Quote 0
        • brodiejB Offline
          brodiej @FRA915 | Premium
          last edited by

          @FRA915 it’s almost certainly a newline at the end of your API key secret.

          The endpoint checks the request’s shape before the key. If the key in -H "x-windy-api-key: …" ends with a line break (\n or \r\n), the request’s headers end early. curl’s multipart Content-Type then isn’t seen, and Windy answers at once with a bare 415 Unsupported Media Type. It does that before reading your archive or checking your key, which is why all 18 variants failed identically. Your hand-typed bad key had no newline, so it reached the key check and got 401 perhaps.

          This usually happens when the secret is saved from a file (gh secret set WINDY_API_KEY < key.txt) or pasted with a line break. To check from inside the Action:

          printf %s "$WINDY_API_KEY" | tail -c 2 | od -c   # shows \n or \r at the end if the secret has one
          

          To fix it, re-save the secret without the newline (printf %s 'YOUR_KEY' | gh secret set WINDY_API_KEY), or strip it before the curl:

          WINDY_API_KEY="$(printf %s "$WINDY_API_KEY" | tr -d '\r\n')"
          

          Your command and archive are otherwise right; they’re the same as what we use.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Windy Community  |  Powered by excellent NodeBB
          Terms of Use     Privacy Policy     Windy.com