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

Webpack build warning #438

Closed
ChristopherGillis opened this issue Mar 23, 2023 · 4 comments
Closed

Webpack build warning #438

ChristopherGillis opened this issue Mar 23, 2023 · 4 comments
Labels
bug This issue is a bug.

Comments

@ChristopherGillis
Copy link

Repeatedly seeing this warning:

Warning: in ../../../node_modules/aws-crt/dist/native/binding.js 59:18-31
  Critical dependency: the request of a dependency is an expression

Screenshot 2023-03-23 at 11 56 08 AM

I see a related PR that is closed, but as of latest release, still seeing the error. #220

I have [email protected] installed as a dependency of @aws-sdk/[email protected]

@jmklix
Copy link
Member

jmklix commented Apr 14, 2023

What exactly are you trying to build? Is this warning preventing you from useing this dependency?

We have the browser samples working for aws-iot-device-sdk-js-v2 with webpack, so this should be working for you

@jmklix jmklix added the response-requested Waiting on additional info and feedback. Will move to 'closing-soon' in 7 days. label Apr 14, 2023
@jmklix jmklix added the closing-soon This issue will automatically close in 4 days unless further comments are made. label May 11, 2023
@unclejustin
Copy link

I get the same warning building with NextJS.

FWIW the aws-crt still works this warning is just cluttering up the logs.

@unclejustin
Copy link

I am able to work around this issue by suppressing the warning as described here.

My updated next.config.js excerpt:

const webpack = require("webpack");

/** @type {import('next').NextConfig} */
const nextConfig = {
  webpack: (config) => {
    config.plugins.push(
      new webpack.ContextReplacementPlugin(/\/aws-crt\//, (data) => {
        delete data.dependencies[0].critical;
        return data;
      })
    );
    return config;
  },
};

module.exports = nextConfig;

@jmklix jmklix added bug This issue is a bug. and removed response-requested Waiting on additional info and feedback. Will move to 'closing-soon' in 7 days. closing-soon This issue will automatically close in 4 days unless further comments are made. labels May 17, 2023
@bretambrose
Copy link
Contributor

The native addon is loaded from a path computed dynamically based on the local host's architecture and OS properties. So on the surface this isn't something we can "fix."

You can suppress the warning using the solution above.

Another alternative is to use the browser distribution which does not need to load the native addon. In our browser samples, the redirection is found in the tsconfig: https://github.com/awslabs/aws-crt-nodejs/blob/main/samples/browser/http/tsconfig.json#L39-L41

The caveat about the browser implementation is that it does not contain Sigv4a support (AWS authentication that uses ECDSA signatures)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug.
Projects
None yet
Development

No branches or pull requests

4 participants