slackapi / node-slack-sdk

Slack Developer Kit for Node.js

Home Page:https://slack.dev/node-slack-sdk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Web-sdk not compatible with CRA?

Chaffexd opened this issue · comments

(Filling out the following with as much detail as you can provide will help us solve your issue sooner.)

Packages:

Select all that apply:

  • @slack/web-api
  • @slack/rtm-api
  • @slack/webhooks
  • @slack/oauth
  • @slack/socket-mode
  • @slack/types
  • I don't know

Reproducible in:

https://github.com/contentful/create-contentful-app
If you create an app with the Contentful CRA or standard create react app you get the following:

Module not found: Error: Can't resolve 'querystring' in '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/dist'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "querystring": require.resolve("querystring-es3") }'
        - install 'querystring-es3'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "querystring": false }
WARNING in ./node_modules/@slack/logger/dist/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/logger/src/index.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/logger/src/index.ts'

WARNING in ./node_modules/@slack/types/dist/block-kit/block-elements.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/block-kit/block-elements.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/block-kit/block-elements.ts'

WARNING in ./node_modules/@slack/types/dist/block-kit/blocks.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/block-kit/blocks.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/block-kit/blocks.ts'

WARNING in ./node_modules/@slack/types/dist/block-kit/composition-objects.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/block-kit/composition-objects.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/block-kit/composition-objects.ts'

WARNING in ./node_modules/@slack/types/dist/block-kit/extensions.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/block-kit/extensions.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/block-kit/extensions.ts'

WARNING in ./node_modules/@slack/types/dist/calls.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/calls.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/calls.ts'

WARNING in ./node_modules/@slack/types/dist/dialog.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/dialog.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/dialog.ts'

WARNING in ./node_modules/@slack/types/dist/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/index.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/index.ts'

WARNING in ./node_modules/@slack/types/dist/message-attachments.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/message-attachments.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/message-attachments.ts'

WARNING in ./node_modules/@slack/types/dist/message-metadata.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/message-metadata.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/message-metadata.ts'

WARNING in ./node_modules/@slack/types/dist/views.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/views.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/views.ts'

WARNING in ./node_modules/@slack/web-api/dist/WebClient.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/WebClient.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/WebClient.ts'

WARNING in ./node_modules/@slack/web-api/dist/errors.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/errors.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/errors.ts'

WARNING in ./node_modules/@slack/web-api/dist/file-upload.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/file-upload.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/file-upload.ts'

WARNING in ./node_modules/@slack/web-api/dist/helpers.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/helpers.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/helpers.ts'

WARNING in ./node_modules/@slack/web-api/dist/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/index.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/index.ts'

WARNING in ./node_modules/@slack/web-api/dist/instrument.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/instrument.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/instrument.ts'

WARNING in ./node_modules/@slack/web-api/dist/logger.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/logger.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/logger.ts'

WARNING in ./node_modules/@slack/web-api/dist/methods.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/methods.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/methods.ts'

WARNING in ./node_modules/@slack/web-api/dist/retry-policies.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/retry-policies.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/retry-policies.ts'

WARNING in ./node_modules/@slack/web-api/dist/types/request/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/types/request/index.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/types/request/index.ts'

WARNING in ./node_modules/@slack/web-api/dist/types/response/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/types/response/index.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/types/response/index.ts'

ERROR in ./node_modules/@slack/web-api/dist/WebClient.js 139:22-44
Module not found: Error: Can't resolve 'querystring' in '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/dist'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "querystring": require.resolve("querystring-es3") }'
        - install 'querystring-es3'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "querystring": false }

ERROR in ./node_modules/@slack/web-api/dist/WebClient.js 140:15-30
Module not found: Error: Can't resolve 'path' in '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/dist'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
        - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "path": false }

ERROR in ./node_modules/@slack/web-api/dist/WebClient.js 141:31-46
Module not found: Error: Can't resolve 'zlib' in '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/dist'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "zlib": require.resolve("browserify-zlib") }'
        - install 'browserify-zlib'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "zlib": false }

ERROR in ./node_modules/@slack/web-api/dist/file-upload.js 34:13-26
Module not found: Error: Can't resolve 'fs' in '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/dist'

ERROR in ./node_modules/@slack/web-api/dist/file-upload.js 35:17-34
Module not found: Error: Can't resolve 'stream' in '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/dist'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }'
        - install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "stream": false }

ERROR in ./node_modules/@slack/web-api/dist/instrument.js 38:24-37
Module not found: Error: Can't resolve 'os' in '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/dist'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "os": require.resolve("os-browserify/browser") }'
        - install 'os-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "os": false }

ERROR in ./node_modules/@slack/web-api/dist/instrument.js 39:15-30
Module not found: Error: Can't resolve 'path' in '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/dist'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
        - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "path": false }

The Slack SDK version

"@slack/web-api": "^7.0.1"

(Paste the output of)

npm ls | grep -o "\S\+@\S\+$" | tr @ ' ' | awk -v q='"' '{print q$1q": "q"^"$2q","}' | grep slack

or refer to your package.json

Node.js runtime version

▶ node --version
v18.17.0
(Paste the output of node --version)

OS info

(Paste the output of sw_vers && uname -v on macOS/Linux or ver on Windows OS)
Mac OS 14.3 (23D56)

Steps to reproduce:

Create a contentful app using this link: https://github.com/contentful/create-contentful-app
(Share the commands to run, source code, and project settings)

  1. Once you run the command to start the dev server, you are greeted with all of the issues
  2. repo: https://github.com/Chaffexd/knowledge-hub-webhook
  3. npm run start

Expected result:

No errors, the errors only started occurring when I needed the functionality to post in multiple channels, so I moved the project base to the web-api which has only given me headaches since the start. I've attempted to manually sort the webpack files for this particular issue but I honestly can't get anywhere with it. When I was using the webhook, the project worked fine (the commented out code in Sidebar.tsx is the webhook code) then in api.js I am using the web-sdk

(Tell what you expected to happen)
It to work without an issue. The aim is to make simple requests to Slack to post a message from the Contentful web app

Actual result:

The long string of errors:
(Tell what actually happened with logs, screenshots)
Failed to compile.

Module not found: Error: Can't resolve 'querystring' in '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/dist'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "querystring": require.resolve("querystring-es3") }'
        - install 'querystring-es3'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "querystring": false }
WARNING in ./node_modules/@slack/logger/dist/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/logger/src/index.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/logger/src/index.ts'

WARNING in ./node_modules/@slack/types/dist/block-kit/block-elements.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/block-kit/block-elements.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/block-kit/block-elements.ts'

WARNING in ./node_modules/@slack/types/dist/block-kit/blocks.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/block-kit/blocks.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/block-kit/blocks.ts'

WARNING in ./node_modules/@slack/types/dist/block-kit/composition-objects.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/block-kit/composition-objects.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/block-kit/composition-objects.ts'

WARNING in ./node_modules/@slack/types/dist/block-kit/extensions.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/block-kit/extensions.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/block-kit/extensions.ts'

WARNING in ./node_modules/@slack/types/dist/calls.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/calls.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/calls.ts'

WARNING in ./node_modules/@slack/types/dist/dialog.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/dialog.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/dialog.ts'

WARNING in ./node_modules/@slack/types/dist/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/index.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/index.ts'

WARNING in ./node_modules/@slack/types/dist/message-attachments.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/message-attachments.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/message-attachments.ts'

WARNING in ./node_modules/@slack/types/dist/message-metadata.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/message-metadata.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/message-metadata.ts'

WARNING in ./node_modules/@slack/types/dist/views.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/views.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/types/src/views.ts'

WARNING in ./node_modules/@slack/web-api/dist/WebClient.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/WebClient.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/WebClient.ts'

WARNING in ./node_modules/@slack/web-api/dist/errors.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/errors.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/errors.ts'

WARNING in ./node_modules/@slack/web-api/dist/file-upload.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/file-upload.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/file-upload.ts'

WARNING in ./node_modules/@slack/web-api/dist/helpers.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/helpers.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/helpers.ts'

WARNING in ./node_modules/@slack/web-api/dist/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/index.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/index.ts'

WARNING in ./node_modules/@slack/web-api/dist/instrument.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/instrument.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/instrument.ts'

WARNING in ./node_modules/@slack/web-api/dist/logger.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/logger.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/logger.ts'

WARNING in ./node_modules/@slack/web-api/dist/methods.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/methods.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/methods.ts'

WARNING in ./node_modules/@slack/web-api/dist/retry-policies.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/retry-policies.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/retry-policies.ts'

WARNING in ./node_modules/@slack/web-api/dist/types/request/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/types/request/index.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/types/request/index.ts'

WARNING in ./node_modules/@slack/web-api/dist/types/response/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/types/response/index.ts' file: Error: ENOENT: no such file or directory, open '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/src/types/response/index.ts'

ERROR in ./node_modules/@slack/web-api/dist/WebClient.js 139:22-44
Module not found: Error: Can't resolve 'querystring' in '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/dist'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "querystring": require.resolve("querystring-es3") }'
        - install 'querystring-es3'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "querystring": false }

ERROR in ./node_modules/@slack/web-api/dist/WebClient.js 140:15-30
Module not found: Error: Can't resolve 'path' in '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/dist'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
        - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "path": false }

ERROR in ./node_modules/@slack/web-api/dist/WebClient.js 141:31-46
Module not found: Error: Can't resolve 'zlib' in '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/dist'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "zlib": require.resolve("browserify-zlib") }'
        - install 'browserify-zlib'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "zlib": false }

ERROR in ./node_modules/@slack/web-api/dist/file-upload.js 34:13-26
Module not found: Error: Can't resolve 'fs' in '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/dist'

ERROR in ./node_modules/@slack/web-api/dist/file-upload.js 35:17-34
Module not found: Error: Can't resolve 'stream' in '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/dist'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }'
        - install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "stream": false }

ERROR in ./node_modules/@slack/web-api/dist/instrument.js 38:24-37
Module not found: Error: Can't resolve 'os' in '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/dist'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "os": require.resolve("os-browserify/browser") }'
        - install 'os-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "os": false }

ERROR in ./node_modules/@slack/web-api/dist/instrument.js 39:15-30
Module not found: Error: Can't resolve 'path' in '/Users/shane.chaffe/Documents/Code/khubApp/khub-slack/node_modules/@slack/web-api/dist'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
        - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "path": false }

webpack compiled with 7 errors and 22 warnings

Requirements

For general questions/issues about Slack API platform or its server-side, could you submit questions at https://my.slack.com/help/requests/new instead. 🙇

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

Hello, can you provide a reproduction project or gist? I am not familiar with CRA/contentful, it is unclear to me how this is an issue with the @slack/web-api package?

Based on the stack trace, it seems like you are bundling web-api for use in a runtime that is not node.js (perhaps in a browser?). Is that correct? Is CRA or whatever trying to polyfill node APIs for use in a browser as part of some bundling process? This project only supports the node runtime.

That's correct, CRA or create react app does run in the browser when in use. Is there a suggested way to do this then or is it just not possible?

There is definitely no suggested way to do this officially from us at Slack. Is it possible? Maybe, I'm not sure. Providing compatibility between different JavaScript runtimes is a gnarly problem. I think it would be hard to polyfill every node API that web-api uses in order to be able to use it in the browser. web-api supports some advanced use cases like proxying and client-side certificates; unclear to me what browser APIs exist to try to provide that functionality. I assume that's what this error means:

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

Core node modules like path, stream, zlib, os, etc. are all not natively available in the browser, but web-api relies on it. Perhaps there is a way to polyfill each of these, but that is outside the responsibility of this project.

👋 I haven't tried this myself but this comment might have a workaround for non-Node runtimes - #1603 (comment)