Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

slack deploy fails on Windows but is successful on Linux #316

Open
djbensono opened this issue May 11, 2024 · 6 comments
Open

slack deploy fails on Windows but is successful on Linux #316

djbensono opened this issue May 11, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@djbensono
Copy link

djbensono commented May 11, 2024

The deno-slack versions

"deno-slack-sdk/": "https://deno.land/x/deno_slack_sdk@2.10.0/",
"deno-slack-api/": "https://deno.land/x/deno_slack_api@2.4.0/",

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/esbuild@v0.19.4/mod.js:1626:15)
    at https://deno.land/x/esbuild@v0.19.4/mod.js:1035:25
    at runOnEndCallbacks (https://deno.land/x/esbuild@v0.19.4/mod.js:1461:45)
    at buildResponseToResult (https://deno.land/x/esbuild@v0.19.4/mod.js:1033:7)
    at https://deno.land/x/esbuild@v0.19.4/mod.js:1062:16
    at responseCallbacks.<computed> (https://deno.land/x/esbuild@v0.19.4/mod.js:679:9)
    at handleIncomingPacket (https://deno.land/x/esbuild@v0.19.4/mod.js:739:9)
    at readFromStdout (https://deno.land/x/esbuild@v0.19.4/mod.js:655:7)
    at https://deno.land/x/esbuild@v0.19.4/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.

@filmaj filmaj added bug Something isn't working needs info not enough information to reproduce or continue labels May 13, 2024
@filmaj
Copy link
Contributor

filmaj commented May 13, 2024

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?

@djbensono
Copy link
Author

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/microsoft-graph-client@3.0.7",
"microsoft-graph-types": "https://esm.sh/@microsoft/microsoft-graph-types@2.40.0"

@mwbrooks
Copy link
Member

Hey @djbensono, thanks for the details!

Following your steps, I was able to recreate the error on a Windows machine:

  1. Add the following to import_map.json:

    "microsoft-graph-client": "https://esm.sh/@microsoft/microsoft-graph-client@3.0.7",
    "microsoft-graph-types": "https://esm.sh/@microsoft/microsoft-graph-types@2.40.0"
    
  2. Reference the dependency in any source code file (e.g. functions/sample_function.ts):

    import { Client } from "microsoft-graph-client";
    console.log(Client);
    
  3. 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.

@filmaj
Copy link
Contributor

filmaj commented May 14, 2024

Any difference if you use the npm: import specifier instead of esm.sh?

@djbensono
Copy link
Author

djbensono commented May 15, 2024

@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/esbuild@v0.19.4/mod.js:1626:15)
    at https://deno.land/x/esbuild@v0.19.4/mod.js:1035:25
    at runOnEndCallbacks (https://deno.land/x/esbuild@v0.19.4/mod.js:1461:45)
    at buildResponseToResult (https://deno.land/x/esbuild@v0.19.4/mod.js:1033:7)
    at https://deno.land/x/esbuild@v0.19.4/mod.js:1062:16
    at responseCallbacks.<computed> (https://deno.land/x/esbuild@v0.19.4/mod.js:679:9)
    at handleIncomingPacket (https://deno.land/x/esbuild@v0.19.4/mod.js:739:9)
    at readFromStdout (https://deno.land/x/esbuild@v0.19.4/mod.js:655:7)
    at https://deno.land/x/esbuild@v0.19.4/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.

@filmaj filmaj removed the needs info not enough information to reproduce or continue label May 15, 2024
@filmaj
Copy link
Contributor

filmaj commented May 15, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants