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

failed to parse source map from '.../node_modules/amazon-chime-sdk-js/src/websocketadapter/defaultwebsocketadapter.ts' #2594

Open
manojkalpana24 opened this issue Feb 28, 2023 · 5 comments
Labels
Bug Something isn't working Needs More Information Waiting for more information from builders

Comments

@manojkalpana24
Copy link

failed to parse source map from '.../node_modules/amazon-chime-sdk-js/src/websocketadapter/defaultwebsocketadapter.ts'
file: error: enoent: no such file or directory, open '.../node_modules/amazon-chime-sdk-js/src/websocketadapter/defaultwebsocketadapter.ts'

Tried upgrading the amazon-chime-sdk-js to the latest version but no use. As 'src/' directory is not published with amazon-chime-sdk-js so it's blocking us from debugging the actual source also the above error is thrown while building the react application.

manojkalpana24 added a commit to manojkalpana24/amazon-chime-sdk-js that referenced this issue Feb 28, 2023
fix: Added src/ directory under files to resolve issue aws#2594
@xuesichao
Copy link
Contributor

Hi @manojkalpana24, sorry for late reply. I don't think we want to publish our src/ folder in our library because we already published compiled src/ folder - build folder.

It seems you imported defaultwebsocketadapter from wrong path.
Try this instead:

node_modules/amazon-chime-sdk-js/build/websocketadapter/DefaultWebSocketAdapter.js

@xuesichao xuesichao added the Needs More Information Waiting for more information from builders label Mar 22, 2023
@senthilnathan27
Copy link

how to use this path node_modules/amazon-chime-sdk-js/build/websocketadapter/DefaultWebSocketAdapter.js in create react app?

@sd-hoag
Copy link

sd-hoag commented Jul 15, 2024

Hi @manojkalpana24, sorry for late reply. I don't think we want to publish our src/ folder in our library because we already published compiled src/ folder - build folder.

It seems you imported defaultwebsocketadapter from wrong path. Try this instead:

node_modules/amazon-chime-sdk-js/build/websocketadapter/DefaultWebSocketAdapter.js

I've also been getting this error - and I am importing from the correct filepath mentioned:
Screenshot 2024-07-15 at 10 06 18 AM

Has there been any research into this?

@mustafashabib
Copy link

mustafashabib commented Jul 31, 2024

Hi @manojkalpana24 and @sd-hoag

If it's helpful, I added the filterSourceMappingUrl option to my webpack.config.js in the root of my project to skip trying to load source maps for these amazon-chime... related dependencies

See here for some details: https://webpack.js.org/loaders/source-map-loader/#filtersourcemappingurl

module: {
  strictExportPresence: true,
  rules: [
      // Handle node_modules packages that contain sourcemaps
      shouldUseSourceMap && {
          enforce: 'pre',
          exclude: /@babel(?:\/|\\{1,2})runtime/,
          test: /\.(js|mjs|jsx|ts|tsx|css)$/,
          loader: require.resolve('source-map-loader'),
          options: {
              filterSourceMappingUrl: (url, resourcePath) => {
                  const shouldSkipLoadingSourceMap =
                      /.*\/node_modules\/.*/.test(resourcePath) && /.*amazon-chime.*/.test(resourcePath);
                  return !shouldSkipLoadingSourceMap;
              },
          },
      },

@jp-hoehmann
Copy link

@xuesichao the root cause of this is the source maps published with amazon-chime-sdk-js. The final distribution contains source maps referencing sources that do not exist. The source maps should either be removed, or the sources they map to should be included.

For example the file build/websocketadapter/WebSocketReadyState.js included in the distribution currently includes the line //# sourceMappingURL=WebSocketReadyState.js.map. This causes the source map build/websocketadapter/WebSocketReadyState.js.map to be loaded, which in turn points to ../../src/websocketadapter/WebSocketReadystate.ts, which isn't included in the distribution, causing the error. To fix this, either the sources should be included in the distribution (allowing developers to step into the actual code of amazon-chime-sdk-js during debugging, but at the cost of increasing the package size), or the source maps (along with the references to them in the compiled javascript files) should be removed from the final package.

@ltrung ltrung added the Bug Something isn't working label Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Needs More Information Waiting for more information from builders
Projects
None yet
Development

No branches or pull requests

7 participants