[BUG] `Error: invalid character '\n' in string literal` when running locally
The deno-slack versions
"deno-slack-hub/": "https://deno.land/x/[email protected]/",
"deno-slack-sdk/": "https://deno.land/x/[email protected]/",
"deno-slack-api/": "https://deno.land/x/[email protected]/"
Deno runtime version
deno 1.46.2 (stable, release, aarch64-apple-darwin)
v8 12.9.202.5-rusty
typescript 5.5.2
OS info
ProductName: macOS
ProductVersion: 15.3
BuildVersion: 24D60
Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:16 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6000
Describe the bug
We recently changed our Slack workspace name, and started seeing these issues after that. Not sure if it's related.
We have our app deployed to Slack and it's running just fine. When I try to run locally without adding any additional code, I'm receiving the error: Error: invalid character '\n' in string literal
If I run deno fmt then deno lint or deno check it doesn't find anything wrong w/ any files.
The odd thing is that if I remove all but one workflow from the manifest.ts file, everything works perfectly, and I can use that workflow without any issues.
I tested each workflow individually, running them one at a time, and they all worked without errors.
However, the problem arises when I enable multiple workflows simultaneously. Itβs not tied to any specific combination of workflows either. Sometimes, I can have up to seven workflows enabled, and everything runs smoothly. But if I remove one and replace it with another, the system breaks.
Strangely, if I disable all other workflows and run only the one that caused the break, it works perfectly on its own.
slack doctor doesn't reveal anything helpful. Everything is up to date.
Hey @benjrich-jasper! π This is a strange error and it's not super clear what might be causing it...
We recently changed our Slack workspace name, and started seeing these issues after that. Not sure if it's related.
IMO this is interesting and I'm wondering if this error started to appear after the workspace name was changed? If so, was the workspace name updated to have non-alphanumeric characters by chance? πΎ
Also, at a glance I'm wondering this is due to a Slack CLI parsing issue as part of the get-manifest hook... Is it possible to share --verbose outputs appearing around this error? I'm happy to investigate this more with you, but finding the cause of this might take some searching π
If you can also share the version of deno-slack-hooks and the Slack CLI you're using, from the slack.json file and slack version command, that'd be super helpful to know too!
Yeah, it's definitely a weird one. I've spent a ton of time trying to find any newline that could be cause issues, but it doesn't seem to be something within our codebase.
Our new workspace name does have two -'s. I did start encountering the issue after the name change, but that could just be coincidence.
The --verbose output is crazy long. I included the file. slack run verbose.txt
slack version output:
Using slack v2.33.0
slack.json contents. I tried updating to 1.3.2 and was still seeing the same error. Our app is running on 1.3.1 so that's what I'm testing on:
{
"hooks": {
"get-hooks": "deno run -q --allow-read --allow-net https://deno.land/x/[email protected]/mod.ts"
}
}
I'm having the same issue after ipdating the slack cli to 3.0.0 slack.json is below
{
"hooks": {
"get-hooks": "deno run -q --allow-read --allow-net https://deno.land/x/[email protected]/mod.ts"
}
}
we didn't change the workspace name and this happened right after i updated slack cli
i went back to a previous cli version and it worked again w/o any other change
curl -fsSL https://downloads.slack-edge.com/slack-cli/install.sh | bash -s -- -v 2.32.0 -d slack2-32-0
slack2-32-0 manifest
I think starting from v2.33.0 something broke @zimeg
@benjrich-jasper Thank you so much for sharing that output!
I was meaning to follow up sooner, but these pointed out that the CLI wasn't parsing outputs of large manifests right - the linebreaks shown in these logs were breaking JSON parsing!
We've found a fix that should work alright with the attached manifest and will include this in the next release πΎ
For now, let's reopen this issue until a release brings a fix or in case other related issues appear β¨
@tzuo9 I'm hoping that for now using v2.32.0 continues to be alright, but I'm hopeful the same fix can be applied in the next release! π
Without the entire error logs I can't know for certain though... If the outputs of the following command has linebreaks between a random hash of "message boundaries" then I'd be most hopeful. But if another error is appearing I'd for sure be curious to know:
$ slack manifest --verbose
@benjrich-jasper @tzuo9 The Slack CLI v3.0.1 release was published with a hopeful fix for this! π€
If possible it'd be great to know if these changes remove the errors found with the manifest command?
$ curl -fsSL https://downloads.slack-edge.com/slack-cli/install.sh | bash -s -- -v 3.0.1
I'm quite interested in finding the cause of this if errors continue though, so please let me know! These comments are super helpful towards each release, so thank you once again for sharing details and logs π
It's working for me now that I've updated to 3.0.1. Thank you! Appreciate the help here.
One issue I just encountered.
I just deleted my local repo and pulled from source to get me into a clean state after trying to debug for the past month. After doing this, slack manifest validate -a local was failing with:
Error running 'GetManifest' command: exit status 10 (sdk_hook_invocation_failed)
Suggestion: Run `slack doctor` to check that your system dependencies are up-to-date.
I ran slack manifest validate -a local --verbose and saw the following line:
[2025-03-20 11:58:56] error: Integrity check failed for remote specifier. The source code is invalid, as it does not match the expected hash in the lock file.
Deleting and regenerating the deno.lock file resolved this.
rm deno.lock && deno cache --reload .