Amplify UI

Troubleshooting

Workarounds for common issues using Amplify UI.

Global and Process Shim

Angular does not include shims for global or process. Follow the instructions below to resolve global or process reference errors.

First, create src/polyfills.ts and add the following:

(window as any).global = window;
(window as any).process = {
  env: { DEBUG: undefined },
};

Then, open your angular.json file, and add src/polyfills.ts to polyfills array(s) in your angular.json. These arrays are located in projects.<project-name>.architect.<task-name>.options.

"polyfills": [
  "zone.js",
"src/polyfills.ts"
],

And finally, make sure to add src/polyfills to files in your tsconfig:

{
  "files": [
    "src/main.ts",
"src/polyfills.ts"
], }

Add the following to your src/polyfills.ts:

(window as any).global = window;
(window as any).process = {
  env: { DEBUG: undefined },
};

Could not find a declaration file for module './aws-exports'

If you run into TypeScript errors importing aws-exports.js, create aws-exports.d.ts file in the directory aws-exports.js is in and add the following content:

declare const awsmobile: Record<string, any>
export default awsmobile;

Problems with OnPush change detection

The Authenticator component currently does not support use of the OnPush change detection strategy. Please use the Default strategy instead.

Warning: CommonJS or AMD dependencies

If you see CommonJS or AMD dependencies optimization bailouts warnings, add the following content to your angular.json.

Amplify open source software, documentation and community are supported by Amazon Web Services.

© 2024 Amazon Web Services, Inc. and its affiliates. All rights reserved. View the site terms and privacy policy.

Flutter and the related logo are trademarks of Google LLC. We are not endorsed by or affiliated with Google LLC.