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

Critical Dependency - got / keyv #1298

Closed
starlight-akouri opened this issue May 24, 2023 · 5 comments
Closed

Critical Dependency - got / keyv #1298

starlight-akouri opened this issue May 24, 2023 · 5 comments

Comments

@starlight-akouri
Copy link

starlight-akouri commented May 24, 2023

Upon installing Ably with npm install I now receive the following errors on my logs:

Critical dependency: the request of a dependency is an expression

Import trace for requested module:
./node_modules/keyv/src/index.js
./node_modules/ably/node_modules/cacheable-request/src/index.js
./node_modules/ably/node_modules/got/dist/source/core/index.js
./node_modules/ably/node_modules/got/dist/source/create.js
./node_modules/ably/node_modules/got/dist/source/index.js
./node_modules/ably/build/ably-node.js
./node_modules/ably/promises.js
./app/api/create-token-request/route.ts

Some initial research led to the solution of "just closing my eyes" but for our project that is an unacceptable fix. How can I address this problem derived from the install of Ably?

I am using Next.js 13

┆Issue is synchronized with this Jira Task by Unito

@sync-by-unito
Copy link

sync-by-unito bot commented May 24, 2023

➤ Automation for Jira commented:

The link to the corresponding Jira issue is https://ably.atlassian.net/browse/SDK-3608

@owenpearson
Copy link
Member

Hey @starlight-akouri thanks for reporting this! Unfortunately this is not easy for us to fix right now - unless webpack/kv/cachable-request/got fix it on their end then the only thing we could do is migrate to an alternative nodejs http client.

I know the "close your eyes" comment isn't exactly reassuring but this isn't really a security issue or anything, it just means that some tools which trace modules might not be able to find all the dependencies of keyv. As long as ably-js is able to make an http request in your environment then there shouldn't be an issue.

There are a couple of suggested fixes in the keyv issue which might be worth trying if you'd like to get rid of the warning eg: jaredwray/keyv#45 (comment)

@hiramhuang
Copy link

I received the same warning. I know it's not causing any errors, but it's super annoying.

image

@hugo082
Copy link

hugo082 commented Aug 1, 2023

For those who wants to ignore the warning, you can refer to https://github.com/sindresorhus/got/issues/2267#issuecomment-1659768856

/** @type {import('next').NextConfig} */
const nextConfig = {
  // ...
  webpack: (config) => {
    // Ignore ALL webpack warnings produced by ./node_modules/keyv/src/index.js file
    config.ignoreWarnings = [
      { module: /node_modules\/keyv\/src\/index\.js/ },
    ];

    return config;
  },
};

module.exports = nextConfig;

@VeskeR
Copy link
Contributor

VeskeR commented May 17, 2024

Updating the suggested solution for this:

You should add the next line to your next.config.js file:

const nextConfig = {
  // ...
  experimental: {
    serverComponentsExternalPackages: ['ably'],
  },
};

You can read more about what is causing this in our README section and in next issue's comment: #1699 (comment).

Closing this issue as this warning is not caused by Ably.

@VeskeR VeskeR closed this as completed May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants