containers-roadmap icon indicating copy to clipboard operation
containers-roadmap copied to clipboard

[ECS] : console escapes backslash when configuring task definition via JSON

Open anamika-avinash opened this issue 4 years ago • 6 comments

Whenever a user utilises the ECS Console to create a new task definition using the 'JSON' representation, the ECS console escapes “\” when entered in values of task definitions. It is no longer possible to enter valid JSON values containing newlines into the ENV (\n) of a task definition via the console because the form fields are only single line text fields which don't support newlines. This has been an issue for many months.

Creating the task definition with new lines (\n) via the SDK or CLI is working (the backslash "\" is not escaped).

Whenever I tried to introduce a new line within the 'Environment' portion, the console escapes the backslash, so as result, it converts a newline (\n) into (\\n) escaping the backslash.

Which service(s) is this request for? This could be Fargate, ECS

anamika-avinash avatar Jan 17 '20 12:01 anamika-avinash

This causes a living hell for people using the UI to update services. Is there anyway around this?

arvindkhadri avatar Jul 16 '20 14:07 arvindkhadri

Any advise for this issue, or we should create the task definition in another way? My problem is a private key from firebase I’m sending that like a env var to my container any help here ?

cristianPerez avatar Aug 29 '20 00:08 cristianPerez

Solution

I found this little note in terraform's documentation I just put the triple backslash \\\\n

Screen Shot 2020-08-28 at 9 03 58 PM

My task definition now is working.

cristianPerez avatar Aug 29 '20 02:08 cristianPerez

Having the same problem here. Tried with the triple backslash and it didn't work, unfortunately.

MarcusBondezan avatar Apr 22 '22 22:04 MarcusBondezan

Also having this issue from the console - any advice?

shadowfool avatar Sep 03 '22 01:09 shadowfool

Ah I've found a solution for in aws console editing.

Using the new V2 console, we no longer get double escapes: https://us-east-1.console.aws.amazon.com/ecs/v2/

shadowfool avatar Sep 03 '22 02:09 shadowfool