bivac: Error in Log: invalid character ' ' in string escape code
Hi I’m using bivac to backup a bunch of docker volumes. Bivac runs as docker container itself, using the following docker-compose.yml (latest was version 2.1.0):
version: '2'
services:
bivac:
image: camptocamp/bivac:latest
command: manager
container_name: bivac
restart: always
ports:
- "8182:8182"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "/var/backups:/var/backups"
environment:
BIVAC_SERVER_PSK: my-psk
RESTIC_PASSWORD: my-password
BIVAC_TARGET_URL: /var/backups
BIVAC_AGENT_IMAGE: camptocamp/bivac:latest
The backup process seems to work properly - the restic repo is created under /var/backups/my.server.net
of the docker host.
But if I use docker-compose logs
, I see the following errors:
https://pastebin.com/XxCfHPWY
First a warning
[36mbivac |[0m time="2019-08-26T05:56:23Z" level=warning msg="failed to unmarshal agent output: invalid character ' ' in string escape code -> ` ... big output as in the above pastebin ... `
followed by an error
[36mbivac |[0m time="2019-08-26T05:56:23Z" level=error msg="failed to backup volume: invalid character ' ' in string escape code" ` ... big output as in the above pastebin ... `
Do you see any issues?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 45 (19 by maintainers)
Ok, great! I’m working on a cleaner fix and will release a new minor version asap.
Thank you very much @neuhausf and @dhilgarth for you help!
@cryptobioz Yes, but I used an online Base64 Decoder: https://www.base64decode.org/
If you paste my output (and remove the trailing `") then you end with a json which contains base64 decoded output itself.
I managed to properly decode all 3 stdout objects.
I just saw the same issue in the logs. As far as I can tell, there is a space character in the middle of the JSON string at an unexpected location. In my case, it was between a backslash and the corresponding double quote that it escaped.
I found it by copying the text from the bivac log and assigning it to a variable. I used Javascript. Then, I tried to use
JSON.parse
on that variable and got an error message pointing to a specific location in that string.The original string in the log looks like this:
You can see the space after the double backslash after
time
.Assigning it to a variable results in this:
(Maybe this area of the code is related to it: Lines 185 to 188 of https://github.com/camptocamp/bivac/blob/951ea2734fbc0f410ee55edbb9a32bc5eb5e63ca/pkg/orchestrators/docker.go - at least that’s where the string is coming from that it then fails to parse)