Skip to content

Conversation

@ericclemmons
Copy link
Contributor

Issue #, if available: Fixes #6750

  • Introduced by feat(SSR): withSSRContext #6146, Credentials referenced Amplify.Auth for deferring to Auth.currentUserCredentials(), but only when Auth was imported/registered.

  • The bug was that Auth = Amplify.Auth only worked when Auth was already imported & registered first, which wasn't always the case.

  • Instead, this.Auth is preferred over Amplify.Auth within the _keepAlive function at run-time, rather than when constructed. This ensures that this.Auth wins for SSR, but Amplify.Auth is always the latest reference.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ericclemmons ericclemmons self-assigned this Sep 16, 2020
@ericclemmons ericclemmons added Auth Related to Auth components/category bug Something isn't working labels Sep 16, 2020
@codecov
Copy link

codecov bot commented Sep 16, 2020

Codecov Report

Merging #6811 into main will increase coverage by 0.04%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6811      +/-   ##
==========================================
+ Coverage   73.31%   73.35%   +0.04%     
==========================================
  Files         212      212              
  Lines       13144    13145       +1     
  Branches     2565     2566       +1     
==========================================
+ Hits         9636     9642       +6     
+ Misses       3314     3309       -5     
  Partials      194      194              
Impacted Files Coverage Δ
packages/core/src/Credentials.ts 31.51% <100.00%> (+0.71%) ⬆️
packages/core/src/Amplify.ts 100.00% <0.00%> (+1.96%) ⬆️
packages/core/src/JS.ts 95.23% <0.00%> (+2.85%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ff7cf7b...7f7bac1. Read the comment docs.

Copy link
Contributor

@sammartinez sammartinez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🌮

Copy link
Contributor

@elorzafe elorzafe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ericclemmons ! 🌮 🎉 🥇

@jumanahalasadi
Copy link

How can I get this fix? Is this in the latest version if I do an npm install for Amplify

@sammartinez
Copy link
Contributor

How can I get this fix? Is this in the latest version if I do an npm install for Amplify

Correct @jumanahalasadi Please use the latest version for this fix. Do remember to do a rm -rf node_modules and any lock file you have

@jumanahalasadi
Copy link

Okay thanks! :) @sammartinez

nubpro pushed a commit to nubpro/amplify-js that referenced this pull request Oct 2, 2020
…lify#6811)

* Add tests for Credentials.Auth

* Credentials.Auth is referenced when needed vs. when constructed
iartemiev pushed a commit that referenced this pull request Oct 13, 2020
* Add tests for Credentials.Auth

* Credentials.Auth is referenced when needed vs. when constructed
@github-actions
Copy link

This pull request has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Auth Related to Auth components/category bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auth.currentCredentials() fails with exception "No Auth module registered in Amplify"

4 participants