Private plugin upload: always HTTP 415 on /plugins/v1.0/upload
-
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!
-
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!
-
@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 oneTo 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.