deno-slack-sdk
deno-slack-sdk copied to clipboard
slack deploy fails on Windows but is successful on Linux
The deno-slack
versions
"deno-slack-sdk/": "https://deno.land/x/[email protected]/", "deno-slack-api/": "https://deno.land/x/[email protected]/",
Deno runtime version
deno 1.43.2 (release, x86_64-pc-windows-msvc) v8 12.4.254.12 typescript 5.4.5
OS info
Microsoft Windows [Version 10.0.22631.3447]
Describe the bug
slack deploy
gives the following error when ran on a Windows based machine:
error packaging project: Command for 'BuildProject' returned an error: exit status 1
X [ERROR] Could not resolve "\\Users\\username\\source\\repos\\ensono-slack-events\\functions\\daily_events\\send_daily_events_message.ts" [plugin deno-resolver]
The plugin "deno-resolver" didn't set a resolve directory, so esbuild did not search for "\\Users\\username\\source\\repos\\ensono-slack-events\\functions\\daily_events\\send_daily_events_message.ts" on the file system.
Error bundling function file "send_daily_events_message" with esbuild
error: Uncaught (in promise) Error: Build failed with 1 error:
error: Could not resolve "\\Users\\username\\source\\repos\\ensono-slack-events\\functions\\daily_events\\send_daily_events_message.ts"
let error = new Error(text);
^
at failureErrorWithLog (https://deno.land/x/[email protected]/mod.js:1626:15)
at https://deno.land/x/[email protected]/mod.js:1035:25
at runOnEndCallbacks (https://deno.land/x/[email protected]/mod.js:1461:45)
at buildResponseToResult (https://deno.land/x/[email protected]/mod.js:1033:7)
at https://deno.land/x/[email protected]/mod.js:1062:16
at responseCallbacks.<computed> (https://deno.land/x/[email protected]/mod.js:679:9)
at handleIncomingPacket (https://deno.land/x/[email protected]/mod.js:739:9)
at readFromStdout (https://deno.land/x/[email protected]/mod.js:655:7)
at https://deno.land/x/[email protected]/mod.js:1924:11
at eventLoopTick (ext:core/01_core.js:168:7) (sdk_hook_invocation_failed)
However, when executed as part of a Github Action running on a Ubuntu 22.04.4 LTS agent - slack deploy
is executed successfully and the application is deployed to my Slack workspace.
I have seen similar issues regarding problems with Windows and these point to having spaces within the path or linting issues from within Deno. There are no spaces in my full folder path and deno lint
returns no linting errors.
We've had a couple of reports (mostly internally) about the bundling failing more often on Windows 😞
Are you using any third party dependencies in the functions\\daily_events\\send_daily_events_message.ts
file @djbensono ?
Another question: does slack run
for this function execute OK?
Hey @filmaj,
Yes, slack run
is working fine.
In terms of third-party integrations we are relying on the microsoft-graph-client
and accompanying packages as shown in my import_map.json
:
"microsoft-graph-client": "https://esm.sh/@microsoft/[email protected]",
"microsoft-graph-types": "https://esm.sh/@microsoft/[email protected]"
Hey @djbensono, thanks for the details!
Following your steps, I was able to recreate the error on a Windows machine:
-
Add the following to
import_map.json
:"microsoft-graph-client": "https://esm.sh/@microsoft/[email protected]", "microsoft-graph-types": "https://esm.sh/@microsoft/[email protected]"
-
Reference the dependency in any source code file (e.g.
functions/sample_function.ts
):import { Client } from "microsoft-graph-client"; console.log(Client);
-
Run
slack deploy
on a Windows machine
I receive the same error when I run the build hook directly, instead of using the deploy command. So that may help us narrow down the culprit.
Bundling worked okay on macOS.
Any difference if you use the npm:
import specifier instead of esm.sh?
@filmaj,
Using npm
gives the same error:
error packaging project: Command for 'BuildProject' returned an error: exit status 1
X [ERROR] Could not resolve "\\Users\\username\\source\\repos\\ensono-slack-events\\functions\\daily_events\\send_daily_events_message.ts" [plugin deno-resolver]
The plugin "deno-resolver" didn't set a resolve directory, so esbuild did not search for "\\Users\\username\\source\\repos\\ensono-slack-events\\functions\\daily_events\\send_daily_events_message.ts" on the file system.
Error bundling function file "send_daily_events_message" with esbuild
error: Uncaught (in promise) Error: Build failed with 1 error:
error: Could not resolve "\\Users\\username\\source\\repos\\ensono-slack-events\\functions\\daily_events\\send_daily_events_message.ts"
let error = new Error(text);
^
at failureErrorWithLog (https://deno.land/x/[email protected]/mod.js:1626:15)
at https://deno.land/x/[email protected]/mod.js:1035:25
at runOnEndCallbacks (https://deno.land/x/[email protected]/mod.js:1461:45)
at buildResponseToResult (https://deno.land/x/[email protected]/mod.js:1033:7)
at https://deno.land/x/[email protected]/mod.js:1062:16
at responseCallbacks.<computed> (https://deno.land/x/[email protected]/mod.js:679:9)
at handleIncomingPacket (https://deno.land/x/[email protected]/mod.js:739:9)
at readFromStdout (https://deno.land/x/[email protected]/mod.js:655:7)
at https://deno.land/x/[email protected]/mod.js:1924:11
at eventLoopTick (ext:core/01_core.js:168:7) (sdk_hook_invocation_failed)
I should also note that using npm
was also previously failing on the Ubuntu agent - hence the reason why we swapped to esm.sh
.
OK, thanks for sharing. As I mentioned, we've had a few reports of this.
I intend to experiment with adding another fallback to slack deploy
bundling in case esbuild
fails: shelling out to deno vendor
to bundle dependencies, though this is a work in progress and I can provide no timeline on it.