# NextJS App on AWS Amplify after login always get checks.state argument is missing

**URL:** <https://community.auth0.com/t/nextjs-app-on-aws-amplify-after-login-always-get-checks-state-argument-is-missing/95195>\
**Category:** Get Help\
**Tags:** authentication-sessions, sessions\
**Created:** [November 28, 2022, 3:50am UTC](https://community.auth0.com/t/nextjs-app-on-aws-amplify-after-login-always-get-checks-state-argument-is-missing/95195 "2022-11-28T03:50:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bryan84](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bryan84/32/34795_2.png) [@bryan84](https://community.auth0.com/u/bryan84)\
**Post date:** [November 28, 2022, 3:50am UTC](https://community.auth0.com/t/nextjs-app-on-aws-amplify-after-login-always-get-checks-state-argument-is-missing/95195/1 "2022-11-28T03:50:23Z")

</div>

I used the Nextjs quick start and everything works fine on my local application and users can sign in as expected.

On AWS Amplify, things did not work as they did locally. I’ve gotten all of the ENV variables into the NodeJS environment (backend portion of the NextJS app) and this allows users to start the login flow, but then once they actually log in (social or username/pass) the application always shows the following error: **checks.state argument is missing**

Now, I looked into where in the auth flow it was getting hung up and found this:

 ![localhost](https://global.discourse-cdn.com/auth0/original/3X/b/a/baaa62ef786ca835a8dda8f09c60170ffaa79f32.jpeg)  
This is the localhost version (that works) from the chrome network tab, and it shows setting the state cookie from the server after calling the /auth/login endpoint.

 ![aws](https://global.discourse-cdn.com/auth0/original/3X/1/d/1dedc8acd4e47cd59eb32ec7f181fb2fdc4627e8.jpeg)  
This is the AWS amplify hosted version, where the same exact request with the same code is not causing the server to set the state cookie.

No matter how many different browsers, incognito, or sessions I try I always get that same error.

Any ideas why this might be happening?

---

<div class="post-metadata">

**Author:** ![sw1ZZlez](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sw1zzlez/32/41741_2.png) [@sw1ZZlez](https://community.auth0.com/u/sw1ZZlez)\
**Post date:** [December 6, 2022, 1:55am UTC](https://community.auth0.com/t/nextjs-app-on-aws-amplify-after-login-always-get-checks-state-argument-is-missing/95195/2 "2022-12-06T01:55:34Z")

</div>

I have had this issue in the past and have been able to resolve it by confirming my Auth0 Base URL and callback URL are correct. However my most recent deployment is having the same issue and I have check all of the usual culprits 100x. Also using NextJS deployed through amplify. No idea what is going on here.

---

<div class="post-metadata">

**Author:** ![bryan84](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bryan84/32/34795_2.png) [@bryan84](https://community.auth0.com/u/bryan84)\
**Post date:** [December 6, 2022, 5:28am UTC](https://community.auth0.com/t/nextjs-app-on-aws-amplify-after-login-always-get-checks-state-argument-is-missing/95195/3 "2022-12-06T05:28:55Z")

</div>

With some help from AWS we got this working, and a few things needed to be done to fix this issue. Hope this helps someone!

1. Make sure your platform is set to WEB\_DYNAMIC, since the WEB\_COMPUTE platform (it’s a new one) appears to not be compatible yet with the Auth0 integration and fails with this error.
2. Ensure that the nextjs version you’re using is set as a package version override on amplify setup in build image settings. Even if you have it set in your package.json file, you need to add it as an override to ensure the build uses the correct version.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [December 6, 2022, 10:43am UTC](https://community.auth0.com/t/nextjs-app-on-aws-amplify-after-login-always-get-checks-state-argument-is-missing/95195/4 "2022-12-06T10:43:52Z")

</div>

Thanks a lot for sharing it with the rest of community!

---

<div class="post-metadata">

**Author:** ![sw1ZZlez](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sw1zzlez/32/41741_2.png) [@sw1ZZlez](https://community.auth0.com/u/sw1ZZlez)\
**Post date:** [December 7, 2022, 12:28am UTC](https://community.auth0.com/t/nextjs-app-on-aws-amplify-after-login-always-get-checks-state-argument-is-missing/95195/5 "2022-12-07T00:28:31Z")

</div>

I have switched to WEB\_DYNAMIC and set the package version override and I am still getting the same issue. Was there anything else that needed to be changed?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [December 21, 2022, 12:29am UTC](https://community.auth0.com/t/nextjs-app-on-aws-amplify-after-login-always-get-checks-state-argument-is-missing/95195/6 "2022-12-21T00:29:17Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
