amplify-js: Could not resolve "@aws-amplify/core/internals/utils" in Angular 17 project after migration

Before opening, please confirm:

JavaScript Framework

Angular

Amplify APIs

Not applicable

Amplify Version

v6

Amplify Categories

Not applicable

Backend

None

Environment information

# Put output below this line


Describe the bug

When running my Angular project with the new Amplify, I get this:

✘ [ERROR] Could not resolve “@aws-amplify/core/internals/utils”

../../node_modules/.pnpm/@aws-amplify+api@6.0.17_@aws-amplify+core@6.0.17/node_modules/@aws-amplify/api/dist/esm/index.mjs:4:25:
  4 │ export { ApiError } from '@aws-amplify/core/internals/utils';
    ╵                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path “@aws-amplify/core/internals/utils” as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

Expected behavior

No error

Reproduction steps

Not sure, I am getting this in my current Angular project, but in a new test project where I tested out Amplify 6 with Angular 17, I dont get this error.

One difference is that the test project is installed via npm, and my production project is using PNPM for package management. Not sure if that is relevant.

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line
✘ [ERROR] Could not resolve "@aws-amplify/core/internals/utils"

    ../../node_modules/.pnpm/@aws-amplify+api@6.0.17_@aws-amplify+core@6.0.17/node_modules/@aws-amplify/api/dist/esm/index.mjs:4:25:
      4 │ export { ApiError } from '@aws-amplify/core/internals/utils';
        ╵                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "@aws-amplify/core/internals/utils" as external to exclude it from the
  bundle, which will remove this error and leave the unresolved path in the bundle.


aws-exports.js

No response

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

About this issue

  • Original URL
  • State: open
  • Created 4 months ago
  • Comments: 24 (7 by maintainers)

Most upvoted comments

Hello,

I have the same error for RN project. (after migration from v5 to V6)

The package.json file :

"dependencies": { "@aws-amplify/core": "5.1.13", "@aws-amplify/react-native": "^1.0.20", "@react-native-async-storage/async-storage": "^1.22.3", "@react-native-camera-roll/camera-roll": "^7.2.2", "@react-native-community/datetimepicker": "7.0.0", "@react-native-community/netinfo": "^11.3.1", "@react-native-firebase/app": "18.8.0", "@react-native-firebase/crashlytics": "18.8.0", "@react-native-firebase/messaging": "18.8.0", "@react-navigation/bottom-tabs": "6.5.7", "@react-navigation/core": "6.4.8", "@react-navigation/native": "6.1.6", "@react-navigation/stack": "^6.3.20", "aws-amplify": "^6.0.20", "date-fns": "2.29.3", "formik": "2.2.9", "i18next": "22.4.13", "patch-package": "^8.0.0", "react": "18.2.0", "react-i18next": "12.2.0", "react-native": "0.73.2", "react-native-blob-util": "0.19.4", "react-native-config": "1.4.12", "react-native-device-info": "^10.11.0", "react-native-fast-image": "8.6.3", "react-native-gesture-handler": "^2.14.1", "react-native-get-random-values": "^1.11.0", "react-native-linear-gradient": "^2.8.3", "react-native-localize": "2.2.6", "react-native-modal": "13.0.1", "react-native-permissions": "3.7.3", "react-native-safe-area-context": "4.5.0", "react-native-screens": "3.29.0", "react-native-splash-screen": "3.3.0", "react-native-svg": "13.8.0", "react-native-svg-transformer": "1.3.0", "react-native-video": "5.2.1", "react-redux": "8.0.5", "redux": "4.2.1", "redux-persist": "6.0.0", "redux-saga": "1.2.3", "reselect": "4.1.7", "yup": "0.32.11" },

Any idea what could be wrong here?

Thanks,;

EDIT : Got it, the “aws-amplify/core” dependency was generating the issue.

And just to reiterate : when I install amplify in a separate angular project using npm only, it works fine. With pnpm I am experiencing this issue only.

Can you share your package.json ? , so we can reproduce the issue with the same dependencies you are using.

Hi Chris, I upgraded to pnpm 9 and I still get the same error :

../../node_modules/.pnpm/@aws-amplify+api@6.0.28_@aws-amplify+core@6.0.27_aws-cdk-lib@2.128.0_constructs@10.3.0__constructs@10.3.0/node_modules/@aws-amplify/api/dist/esm/index.mjs:4:0-61 - Error: Module not found: Error: Can't resolve '@aws-amplify/core/internals/utils' in '/Users/mattijs/www/respark/apollo/apollo/node_modules/.pnpm/@aws-amplify+api@6.0.28_@aws-amplify+core@6.0.27_aws-cdk-lib@2.128.0_constructs@10.3.0__constructs@10.3.0/node_modules/@aws-amplify/api/dist/esm'

I am working on a side branch to get rid of pnpm but I am in a production build process right now and have limited time. The NX project without pnpm did not have any issue so far.

@AntonyARHS Oh, okay. I am not having that dependency, just aws-amplify so it won’t make any difference from me. I am actually setting up a new mono repo with pnpm, just NX and npm and see how that goes.

Can you share package.json files you have on each package on the monorepo?