Crypto Module Error when using AWS4Axios

0

I am using the aws4-axios package for authentication on a React App. I am using this package in order to authenticate an API call with AWS credentials. When I attempt to start the app, I receive an error about the crypto module. I have attempted to remediate this issue by setting crypto to false in my package.json but the error still occurs. If anyone could help, I would deeply appreciate it.

I am inserting the error below.

ERROR in ./node_modules/aws4/aws4.js 4:13-30
Module not found: Error: Can't resolve 'crypto' in '/mnt/c/Users/dalade/code/repos/prism/prism-dashboard/node_modules/aws4'

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: { "crypto": require.resolve("crypto-browserify") }'
        - install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "crypto": false }

webpack compiled with 1 error
AWS
David A
已提問 2 年前檢視次數 54 次
沒有答案

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南