An error occurred (InvalidParameterException) when calling the UpdateManagedLoginBranding operation: Media type not supported for value: text/plain #9102
Replies: 2 comments
-
|
I have the same issue |
Beta Was this translation helpful? Give feedback.
-
|
That error happens because Cognito then tries to interpret the “bytes” you sent and detects it as plain text ( To make AWS CLI actually read the binary file and send it as a blob, you must pass the blob value via CLI argument parsing (where Use shorthand for aws cognito-idp update-managed-login-branding If you want to keep everything in JSON, then BASE64=$(base64 -i logo.png | tr -d '\n') Then in your JSON request: { Then call: aws cognito-idp update-managed-login-branding --cli-input-json file://request.json In short: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When trying to add assets to aws cognito-idp update-managed-login-branding or aws cognito-idp create-managed-login-branding, I can't seem to find the proper way to upload the asset.
https://docs.aws.amazon.com/cli/latest/reference/cognito-idp/update-managed-login-branding.html says the file type should be "blob" and I've tried taking the asset output (byte string) from a "describe-managed-login-branding" request and additionally tried adding a file path as shown here: https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters-types.html#parameter-type-blob and seem to always get the error: An error occurred (InvalidParameterException) when calling the UpdateManagedLoginBranding operation: Media type not supported for value: text/plain
If I don't include assets in the command, everything works fine.
I've tried:
aws cognito-idp update-managed-login-branding --user-pool-id "USERPOOL" --managed-login-branding-id "BRANDING" --settings "$(< ./settings.json)" --assets "$(< ./assets.json)"
aws cognito-idp update-managed-login-branding --user-pool-id "USERPOOL" --managed-login-branding-id "BRANDING" --settings "$(< ./settings.json)" --assets '[{"Category": "FORM_LOGO", "ColorMode": "DARK", "Extension": "PNG", "Bytes": "file://logo.png"}]'
aws cognito-idp update-managed-login-branding --user-pool-id "USERPOOL" --managed-login-branding-id "BRANDING" --settings "$(< ./settings.json)" --assets '[{"Category": "FORM_LOGO", "ColorMode": "DARK", "Extension": "PNG", "Bytes": "fileb://logo.png"}]'
aws cognito-idp update-managed-login-branding --user-pool-id "USERPOOL" --managed-login-branding-id "BRANDING" --settings "$(< ./settings.json)" --assets '[{"Category": "FORM_LOGO", "ColorMode": "DARK", "Extension": "PNG", "Bytes": "./logo.png"}]'
aws cognito-idp update-managed-login-branding --user-pool-id "USERPOOL" --managed-login-branding-id "BRANDING" --settings "$(< ./settings.json)" --assets '[{"Category": "FORM_LOGO", "ColorMode": "DARK", "Extension": "PNG", "Bytes": "$(cat ./logo.png | base64)"}]'
aws cognito-idp update-managed-login-branding --user-pool-id "USERPOOL" --managed-login-branding-id "BRANDING" --settings "$(< ./settings.json)" --assets '[{"Category": "FORM_LOGO", "ColorMode": "DARK", "Extension": "PNG", "Bytes": null}]' - which returned Invalid type for parameter Assets[0].Bytes, value: None, type: <class 'NoneType'>, valid types: <class 'bytes'>, <class 'bytearray'>, file-like object
Beta Was this translation helpful? Give feedback.
All reactions