TypeError: invalid media type
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.9k
- Forks
- 474
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 53
Description
Describe the bug
I am receiving the following error when receiving a specific request from this service (https://sparkles.sploot.com) to a function running with netlify dev
Netlify crashes before any of my code runs, so I cannot see what the request that causes this looks like.
TypeError: invalid media type
at Object.parse (/home/mpardalos/Documents/mpardalos.com/node_modules/netlify-cli/node_mod
ules/content-type/index.js:126:11)
at serveRedirect (file:///home/mpardalos/Documents/mpardalos.com/node_modules/netlify-cli/
dist/utils/proxy.js:323:62)
System:
OS: Linux 6.13 Fedora Linux 41 (KDE Plasma)
CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1145G7 @ 2.60GHz
Binaries:
Node: 22.14.0 - /usr/bin/node
npm: 10.9.2 - /usr/bin/npm
npmGlobalPackages:
netlify-cli: 19.0.2
Steps to reproduce
Reproducing requires being able to use https://sparkles.sploot.com/login, which requires a site set up for indieauth and micropub. If required, I can try to provide an example with my code.
Configuration
[build]
publish = "public"
command = "hugo --minify"
[build.environment]
HUGO_VERSION = "0.111.3"
[context.deploy-preview]
command = "hugo --minify --buildFuture -b $DEPLOY_PRIME_URL"
[[redirects]]
from = "/micropub"
to = "/.netlify/functions/micropub"
status = 200
[dev]
framework = "hugo"
Environment
System:
OS: Linux 6.13 Fedora Linux 41 (KDE Plasma)
CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1145G7 @ 2.60GHz
Memory: 6.94 GB / 15.34 GB
Container: Yes
Shell: 5.2.32 - /bin/bash
Binaries:
Node: 22.14.0 - /usr/bin/node
npm: 10.9.2 - /usr/bin/npm
npmPackages:
netlify-cli: ^18.1.0 => 18.1.0
npmGlobalPackages:
netlify-cli: 19.0.2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the serveRedirect entry point in dist/utils/proxy.js and inspect how the content-type parser in content-type/index.js handles the request received from sparkles.sploot.com. Reproduce through netlify dev if possible, then establish expected handling for the invalid media type and verify that the CLI no longer crashes before the function runs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100