aws-amplify / amplify-ui

Amplify UI is a collection of accessible, themeable, performant React (and more!) components that can connect directly to the cloud.
https://ui.docs.amplify.aws
Apache License 2.0
814 stars 271 forks source link

[Bug] Liveness - Warnings showing when installing liveness package #5123

Open reesscot opened 5 months ago

reesscot commented 5 months ago

Before creating a new issue, please confirm:

On which framework/platform are you having an issue?

React

Which UI component?

Liveness

How is your app built?

N/A

What browsers are you seeing the problem on?

No response

Which region are you seeing the problem in?

No response

Please describe your bug.

I'm seeing a console warning for @tensorflow/tfjs-backend-webgl when installing Amplify Liveness @aws-amplify/ui-react-liveness package

➜  test-amplify npm install @aws-amplify/ui-react aws-amplify @aws-amplify/ui-react-liveness
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @tensorflow/tfjs-backend-webgl@4.17.0
npm WARN Found: @tensorflow/tfjs-core@4.11.0
npm WARN node_modules/@tensorflow/tfjs-core
npm WARN   @tensorflow/tfjs-core@"4.11.0" from @aws-amplify/ui-react-liveness@3.0.16
npm WARN   node_modules/@aws-amplify/ui-react-liveness
npm WARN     @aws-amplify/ui-react-liveness@"^3.0.16" from the root project
npm WARN   4 more (@tensorflow-models/face-detection, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer @tensorflow/tfjs-core@"4.17.0" from @tensorflow/tfjs-backend-webgl@4.17.0
npm WARN node_modules/@tensorflow/tfjs-backend-webgl
npm WARN   peer @tensorflow/tfjs-backend-webgl@"^4.4.0" from @tensorflow-models/face-detection@1.0.2
npm WARN   node_modules/@tensorflow-models/face-detection
npm WARN
npm WARN Conflicting peer dependency: @tensorflow/tfjs-core@4.17.0
npm WARN node_modules/@tensorflow/tfjs-core
npm WARN   peer @tensorflow/tfjs-core@"4.17.0" from @tensorflow/tfjs-backend-webgl@4.17.0
npm WARN   node_modules/@tensorflow/tfjs-backend-webgl
npm WARN     peer @tensorflow/tfjs-backend-webgl@"^4.4.0" from @tensorflow-models/face-detection@1.0.2
npm WARN     node_modules/@tensorflow-models/face-detection
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @tensorflow/tfjs-backend-cpu@4.17.0
npm WARN Found: @tensorflow/tfjs-core@4.11.0
npm WARN node_modules/@tensorflow/tfjs-core
npm WARN   @tensorflow/tfjs-core@"4.11.0" from @aws-amplify/ui-react-liveness@3.0.16
npm WARN   node_modules/@aws-amplify/ui-react-liveness
npm WARN     @aws-amplify/ui-react-liveness@"^3.0.16" from the root project
npm WARN   4 more (@tensorflow-models/face-detection, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer @tensorflow/tfjs-core@"4.17.0" from @tensorflow/tfjs-backend-cpu@4.17.0
npm WARN node_modules/@tensorflow/tfjs-backend-webgl/node_modules/@tensorflow/tfjs-backend-cpu
npm WARN   @tensorflow/tfjs-backend-cpu@"4.17.0" from @tensorflow/tfjs-backend-webgl@4.17.0
npm WARN   node_modules/@tensorflow/tfjs-backend-webgl
npm WARN
npm WARN Conflicting peer dependency: @tensorflow/tfjs-core@4.17.0
npm WARN node_modules/@tensorflow/tfjs-core
npm WARN   peer @tensorflow/tfjs-core@"4.17.0" from @tensorflow/tfjs-backend-cpu@4.17.0
npm WARN   node_modules/@tensorflow/tfjs-backend-webgl/node_modules/@tensorflow/tfjs-backend-cpu
npm WARN     @tensorflow/tfjs-backend-cpu@"4.17.0" from @tensorflow/tfjs-backend-webgl@4.17.0
npm WARN     node_modules/@tensorflow/tfjs-backend-webgl

What's the expected behaviour?

No warning when installing package

Help us reproduce the bug!

See above

Code Snippet

// Put your code below this line.

Console log output

No response

Additional information and screenshots

No response

jeziellago commented 5 months ago

Hello @reesscot

I'm facing this issue. When I add "@tensorflow/tfjs-core": "^4.17.0" all warnings are solved, but I'm not sure if in that way the amplify would override and use v4.17 instead of 4.11.

reesscot commented 5 months ago

Hi @jeziellago,

The Liveness component has not been tested with @tensorflow/tfjs-core version 4.17.0, so I would recommend continuing to use 4.11.0. If you're using npm, you can use the following override to get rid of the warning:

  "overrides": {
    "@tensorflow/tfjs-core": "4.11.0"
  }

My research shows that the @tensorflow-models/face-detection has a peerDependency on @tensorflow/tfjs-backend-webgl that allows any minor version above 4.4.0. Thus it seems that npm is then installing the latest version of @tensorflow/tfjs-backend-webgl which then requires @tensorflow/tfjs-core version 4.17.0, which causes the warning.

Liveness does not use @tensorflow/tfjs-backend-webgl, so you can safely ignore the warning. I doublechecked what is installed in node_modules by npm when seeing the warning, and all @tensorflow packages other than the unused @tensorflow/tfjs-backend-webgl are correctly showing as 4.11.0.