Closed6
Slack Platform(Deno)で外部ライブラリ(npm)をimportするとDeployできなくなる現象について
$ slack --version
Using slack v2.8.0
$ deno --version
deno 1.36.1 (release, x86_64-apple-darwin)
v8 11.6.189.12
typescript 5.1.6
$ slack deploy
error: Uncaught (in promise) TypeError: The module's source code could not be parsed: Expression expected at file:///Users/nakamuloud/ghq/github.com/nakamuloud/awsome-workflow-steps/functions/post_notion.ts:27:41
const client = new n.Client({"auth":});
~
const functionModule = await import(`file://${functionFilePath}`);
^
at async getDefaultExport (https://deno.land/x/deno_slack_hooks@1.1.0/utilities.ts:27:26)
at async readImportedManifestFile (https://deno.land/x/deno_slack_hooks@1.1.0/get_manifest.ts:114:20)
at async getManifest (https://deno.land/x/deno_slack_hooks@1.1.0/get_manifest.ts:30:22)
at async getValidateAndCleanManifest (https://deno.land/x/deno_slack_hooks@1.1.0/get_manifest.ts:129:29)
at async https://deno.land/x/deno_slack_hooks@1.1.0/get_manifest.ts:136:26
Check /Users/nakamuloud/.slack/logs/slack-debug-20230902.log for full error logs
🚫 Unable to get your app manifest details. Please check your manifest file. (invalid_manifest)
Error Details:
1: Command for 'GetManifest' returned an error: exit status 1 (sdk_hook_invocation_failed)
Suggestion: Run `slack doctor` to check that your system dependencies are up-to-date.
/functions/notion.ts にて npmライブラリをimportすると発生する模様
import { DefineFunction, Schema, SlackFunction } from "deno-slack-sdk/mod.ts";
import * as n from "npm:@notionhq/client";
ここらへんが怪しそう
- Denoの仕組みはよくわかってないけど、Networkのアクセスを許可しないと使えない機構になってるので、それが悪さしている
- manifest.tsのoutgoingDomainsに追加しないいけない
解散
npm dependencies cannot be used in code deployed to Slack, as npm dependencies are not yet supported in deno bundle. Stay tuned for npm support in a future Deno release.
betaになりました!
npm dependencies are supported but are still in beta, so ensure that you test any npm: specifiers when using the slack deploy command (the slack run command is not affected).
このスクラップは2023/09/02にクローズされました