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

Can't resolve @aws-sdk/signature-v4-crt and aws-crt #153

Open
jeslage opened this issue Jul 9, 2023 · 12 comments
Open

Can't resolve @aws-sdk/signature-v4-crt and aws-crt #153

jeslage opened this issue Jul 9, 2023 · 12 comments

Comments

@jeslage
Copy link

jeslage commented Jul 9, 2023

Hey,

first of all, thanks for the library. It works fine so far, the images get uploaded but I always get the following errors. Have you come across this issue already?

Module not found: Can't resolve '@aws-sdk/signature-v4-crt' in './node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs'

Import trace for requested module:
./node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/SignatureV4MultiRegion.js
./node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/index.js
./node_modules/@aws-sdk/s3-request-presigner/dist-cjs/presigner.js
./node_modules/@aws-sdk/s3-request-presigner/dist-cjs/index.js
./node_modules/next-s3-upload/dist/next-s3-upload.cjs.development.js
./node_modules/next-s3-upload/dist/index.js
./components/forms/upload-form.tsx

./node_modules/@aws-sdk/util-user-agent-node/dist-cjs/is-crt-available.js
Module not found: Can't resolve 'aws-crt' in './node_modules/@aws-sdk/util-user-agent-node/dist-cjs'

Import trace for requested module:
./node_modules/@aws-sdk/util-user-agent-node/dist-cjs/is-crt-available.js
./node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js
./node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.js
./node_modules/@aws-sdk/client-sts/dist-cjs/STSClient.js
./node_modules/@aws-sdk/client-sts/dist-cjs/index.js
./node_modules/next-s3-upload/dist/next-s3-upload.cjs.development.js
./node_modules/next-s3-upload/dist/index.js
./components/forms/upload-form.tsx

Versions
Node: 18.15.0
Next: 13.4.7
This package: 0.3.0

If you need further information, just let me know! Thank you!

@t-indie
Copy link

t-indie commented Jul 11, 2023

+1

@jeslage
Copy link
Author

jeslage commented Jul 13, 2023

After running yarn add @aws-sdk/signature-v4-crt aws-crt, I get the following error:

Critical dependency: the request of a dependency is an expression

Import trace for requested module:
./node_modules/aws-crt/dist/native/binding.js
./node_modules/aws-crt/dist/native/checksums.js
./node_modules/aws-crt/dist/index.js
./node_modules/@aws-sdk/util-user-agent-node/dist-cjs/is-crt-available.js
./node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js
./node_modules/@aws-sdk/client-s3/dist-cjs/runtimeConfig.js
./node_modules/@aws-sdk/client-s3/dist-cjs/S3Client.js
./node_modules/@aws-sdk/client-s3/dist-cjs/index.js
./node_modules/next-s3-upload/dist/next-s3-upload.cjs.development.js
./node_modules/next-s3-upload/dist/index.js
./components/forms/upload-form.tsx

@kaje94
Copy link

kaje94 commented Jul 25, 2023

+1

@studiolama
Copy link

getting same error any solution or fix for it ?

@noramass
Copy link

noramass commented Aug 8, 2023

+1

@ryanto
Copy link
Owner

ryanto commented Aug 14, 2023

Thanks for the bug report, I'll start investigating this.

One quick question: is it preventing the library from working?

@jeslage
Copy link
Author

jeslage commented Aug 14, 2023

@ryanto no its not preventing it from working, it works fine with these errors.

@ryanto
Copy link
Owner

ryanto commented Aug 16, 2023

Ok I just published version 0.3.1 which upgrades the AWS dependencies. Let me know if you still see this error.

@martinmiglio
Copy link
Contributor

Still appearing in 0.3.1:

- warn ./node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/SignatureV4MultiRegion.js
Module not found: Can't resolve '@aws-sdk/signature-v4-crt' in '.\node_modules\@aws-sdk\signature-v4-multi-region\dist-cjs'

Import trace for requested module:
./node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/SignatureV4MultiRegion.js
./node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/index.js
./node_modules/@aws-sdk/s3-request-presigner/dist-cjs/presigner.js
./node_modules/@aws-sdk/s3-request-presigner/dist-cjs/index.js
./node_modules/next-s3-upload/dist/next-s3-upload.cjs.development.js
./node_modules/next-s3-upload/dist/index.js
./src/components/PhotoUpload.tsx

./node_modules/@aws-sdk/util-user-agent-node/dist-cjs/is-crt-available.js
Module not found: Can't resolve 'aws-crt' in '.\node_modules\@aws-sdk\util-user-agent-node\dist-cjs'

Import trace for requested module:
./node_modules/@aws-sdk/util-user-agent-node/dist-cjs/is-crt-available.js
./node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js
./node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.js
./node_modules/@aws-sdk/client-sts/dist-cjs/STSClient.js
./node_modules/@aws-sdk/client-sts/dist-cjs/index.js
./node_modules/next-s3-upload/dist/next-s3-upload.cjs.development.js
./node_modules/next-s3-upload/dist/index.js
./src/components/PhotoUpload.tsx

@martinmiglio
Copy link
Contributor

Issue stems from the aws sdk and webpack aws/aws-sdk-js-v3#4126

@martinmiglio
Copy link
Contributor

To avoid the warning, its possible to update the webpack config for nextjs.

Update next.config.js:

/** @type {import('next').NextConfig} */
const config = {
  // …
  webpack: (config, { webpack, isServer, nextRuntime }) => {
    // Avoid AWS SDK Node.js require issue
    if (isServer && nextRuntime === "nodejs")
      config.plugins.push(
        new webpack.IgnorePlugin({ resourceRegExp: /^(aws-crt|@aws-sdk\/signature-v4-crt)$/ })
      );
    return config;
  },
  // …
};

module.exports = config;

credit to aws-amplify/amplify-js#11030 (comment)

@ryanto
Copy link
Owner

ryanto commented Aug 29, 2023

@martinmiglio awesome find!

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

No branches or pull requests

7 participants