Closed coderbyheart closed 2 years ago
Hi @coderbyheart 👋 thank you for raising this issue. I was able to reproduce the issue with the steps to reproduce. However, this doesn't seem to happen on Next, CRA, and/or webpack apps as I wasn't able to reproduce the behavior on a fresh start using those tools. I'm not too familiar with Vite but maybe that's part of the issue. I'm going to transfer this issue over to the UI repo for better support.
Thanks for raising this issue! This is weird because the only two changes between 2.2.0
and 2.2.1
are
I suspect it's the former because the latter doesn't impact auth flows. We will take a look at our earliest capacity. Meanwhile, can you try https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides to force
{
"overrides": {
"xstate": "4.29.0"
}
}
and let us know if that resolves it?
Yes, pinning xstate to 4.29.0 fixes the problem.
Thank you for verifying, please hold onto that workaround while we come up with a holistic fix for bumping xstate
(which we pinned due to TypeScript conflicts). I'll keep you posted.
Update: we'll be pinning to 4.28.0
to unblock immediate runtime problems. 4.29.0
has major typescript changes that we'll need more time to adjust to. For now we'll stick with 4.28.0
.
This is what you already have on your package-lock.json
so this should resolve your application. We'll get a PR up and let you know when it gets released.
@coderbyheart Just to be 100% 4.28.0
resolves the bug, can you try the same overrides
strategy to check if 4.28.0
works on your same PR?
@wlee221 I've added it to the PR already to verify. End-to-end tests pass now: see https://github.com/NordicSemiconductor/asset-tracker-cloud-app-aws-js/commit/7f6281837a12160965d081846e80774ae348288f
Sorry, I see now that it's 4.28 (twenty eight), I was using 4.29 (twenty nine). Will try.
Much appreciate your fast response. We'll merge #1230 and have it released ETA 02/03.
I have the same trouble in a CRA app when i update in 2.2.1. I tried the overrides workaround, it doesn't for me but i'm not sure that i did it well.
@LeJ84, we just released this fix to 2.2.2
. Can you try that veresion (make sure your lock file is updated), and let us know if the problem still persists?
Sorry for the time to answer, but i confirm that 2.2.2 fixes that problem ! Good job !
Awesome!
I tried the 2.2.1, 2.2.2, and 2.3.0 with and without the xstate override, but unfortunately the buttons were still dead (using withAuthenticator in CRA).
Was able to get back on track with 2.2.0
I was having this issue as well and wanted to give ya'll one more data point.
(I'm using the default gatsby starter (gatsby: ^4.6.2))
The xstate override solution did not work for me.
{
"overrides": {
"xstate": "4.29.0"
}
}
Trying 2.2.2 and 2.3.0 did not work either. I was able to get it to work with 2.2.0
Weird... As mentioned the only impactful change from 2.2.0
to 2.2.1
was pinning xstate version to 4.26.1
(Release notes here).
@juliojimenez and @srianbury, can you please provide us a repro repo that we can inspect? And just to confirm, you're on NPM 8+ and not on yarn or other package manager, right? overrides
is NPM 8+ only.
^ edited for typo, overrides
is NPM 8+ only.
Also, any lockfile will be helpful! One for 2.2.0
and 2.2.1
so we can inspect the diff.
@wlee221 Thanks for the info! I did not know that. I am using yarn. It looks like the yarn alternative is resolutions
. I'll try it that way and also with npm afterward. Can you clarify which version of xstate I should pin?
Thanks for the quick response 🙏 Can you try xstate@4.28.0
? This is the version that latest ui-react
uses.
@wlee221 Using
"resolutions": {
"xstate": "4.28.0"
},
With yarn fixed the issue in 2.2.1 for me
Glad it worked! At the same time I'm very confused because that's exactly what https://github.com/aws-amplify/amplify-ui/pull/1230 in @aws-amplify/ui-react@2.2.2
did 🤔
Can you try nuking your lockfile and reinstall everything with ui-react@2.2.2?
It might've had something to do with the lock file. When I switched from 2.2.1
to 2.2.2
I removed my node_modules folder but not the lock file. I will remove node_modules, the lockfile, and the xstate pin, set @aws-amplify/ui-react to 2.2.2, and install again and let you know if it works.
The buttons are not working when I use 2.2.2
Here's the package.json for the 2.2.2 version (this did not work) 2.2.2 package.json Here's the package.json for the 2.2.1 version with xstate pinned to 4.28.0 (this one works) 2.2.1 w/ xstate@4.28.0 And 2.2.0 as is for me as well.
Ah I see why... gatsby itself depends on xstate@^4.26.0
: lockfile. Because Gatsby and @aws-amplify/ui-react
's xstate dependencies versions are incompliant, yarn
will create duplicated entries for xstate
. Duplicated packages will cause behaviors like these...
For now, please dedupe xstate
with resolutions
. I'll bring this up to the team and discuss how to handle this.
Working on #1346 to declare xstate at ^4.29.0
so npm
and yarn
can dedupe them easily.
For what it's worth. I also ran into this issue because I had @aws-amplify/ui-react
installed and then I had another library installed via npm link
that also depended on @aws-amplify/ui-react
. What solved it for me was adding resolve: { dedupe: ["@aws-amplify/ui-react"] }
to my vite.config.ts
Hi @coderbyheart, sorry it took a while! We just updated our xstate dependency to be more compatible to avoid package duplications.
This will be released next Tuesday, and will let you know once that happens. This should remove the need to use overrides
or resolutions
.
Before opening, please confirm:
JavaScript Framework
React
Amplify APIs
Authentication
Amplify Categories
auth
Environment information
Describe the bug
Upgrading from @aws-amplify/ui-react 2.2.0 to 2.2.1 breaks UI interaction:
sign in
button in the sign in component does nothingsignOut()
function in React does nothing.Running it with
Amplify.Logger.LOG_LEVEL = 'DEBUG';
shows nothing in the console.I have an app that has end-to-end tests, which now fail: https://github.com/NordicSemiconductor/asset-tracker-cloud-app-aws-js/pull/9
Expected behavior
Clicking the
sign in
button should log the user in. CallingsignOut()
should log the user out.Reproduction steps
Start the app
Open the browser and the printed URL, select the "Create Account" tab, and fill in some details.
Click "Create Account".
Nothing happens.
If you downgrade to @aws-amplify/ui-react@2.2.0 creating an account works.
Code Snippet
See STR.
Log output
No log output when I click the "Create Account" button.
aws-exports.js
No response
Manual configuration
No response
Additional configuration
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response