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

TypeError: invalid media type #7113

Open
mpardalos opened this issue Mar 18, 2025 · 1 comment
Open

TypeError: invalid media type #7113

mpardalos opened this issue Mar 18, 2025 · 1 comment
Labels
type: bug code to address defects in shipped code

Comments

@mpardalos
Copy link

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

@mpardalos mpardalos added the type: bug code to address defects in shipped code label Mar 18, 2025
@mpardalos
Copy link
Author

Looks like this issue only appears when using a redirect in netlify.toml. Sending a request with Content-Type set to "unknown" triggers this error.

I have worked around this by using the netlify function url (/.netlify/functions/micropub) directly, without using a redirect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

1 participant