patchNode and patchNamespacedService 415 UnsupportedMediaType Errors
See original GitHub issueTrying to patch a node or a namespaced service always returns a “415: Unsupported Media Type” error.
Client Version 0.17.0 Server Version 1.24.2-gke.1900
patchNode Code:
await kc.makeApiClient(k8s.CoreV1Api).patchNode(
instance.name,
{ metadata: { labels: { 'foo': 'bar' }}},
undefined, undefined, undefined, undefined,
{ headers: { 'content-type': PATCH_TYPE }}
)
patchNamespacedService Code:
await kc.makeApiClient(k8s.CoreV1Api).patchNamespacedService(
"nginx-svc",
"default",
{ spec: { externalIPs:
instances.map(instance =>
instance
.networkInterfaces[0]
.networkIP
)
}},
undefined, undefined, undefined, undefined,
{ headers: { 'content-type': PATCH_TYPE }}
)
Using any of the below as PATCH_TYPE causes the error.
- k8s.PatchUtils.PATCH_FORMAT_JSON_PATCH
- k8s.PatchUtils.PATCH_FORMAT_JSON_MERGE_PATCH
- k8s.PatchUtils.PATCH_FORMAT_STRATEGIC_MERGE_PATCH
Using NodeJS v16.16.0
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Unsupported Media Type (HTTP 415) when patching custom ...
Any body content cause the same error, event the empty body — so, I guess, it is not about the patch-content itself. Versions....
Read more >Forge Api PATCH request returns 415 "unsupported media type"
For sure the query object has nothing to do with media type or the error you are getting. Both of my approaches were...
Read more >415 Unsupported Media Type - HTTP - MDN Web Docs
The HTTP 415 Unsupported Media Type client error response code indicates that the server refuses to accept the request because the payload ...
Read more >415 Unsupported Media Type - KeyCDN Support
A 415 Unsupported Media Type error occurs when the origin server refuses a particular request since the resource is in a format that...
Read more >RFC 7231: Hypertext Transfer Protocol (HTTP/1.1)
Response messages with an error status code usually contain a payload that ... The 409 (Conflict) or 415 (Unsupported Media Type) status codes...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The “correct” way to override the headers is via an
Interceptor
see this comment for more details:https://github.com/kubernetes-client/javascript/issues/817#issuecomment-1152607117
We should expand PatchUtils to do this for you.
Closing via https://github.com/kubernetes-client/javascript/pull/872