You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During its creation, Auth class is adding a callback for being notified about framework changes (observeFrameworkChanges). This callback is never cleared (there is no API to remove callbacks from the array) and causes a memory leak when using Auth with server side rendering as one instance is created for every request:
at observeFrameworkChanges (/portal/node_modules/@aws-amplify/core/lib/Platform/detectFramework.js:32:13)
at PlatformBuilder.observeFrameworkChanges (/portal/node_modules/@aws-amplify/core/lib/Platform/index.js:46:55)
at new AuthClass (/portal/node_modules/@aws-amplify/auth/lib/Auth.js:80:25)
at /portal/node_modules/aws-amplify/lib/withSSRContext.js:39:26
at Array.forEach (<anonymous>)
at withSSRContext (/portal/node_modules/aws-amplify/lib/withSSRContext.js:38:13)
at defineAmplify (webpack://webServer/./src/server/services/amplify.ts?:163:84)
at eval (webpack://webServer/./src/server/services/async.ts?:8:19)
at Layer.handle [as handle_request] (/portal/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/portal/node_modules/express/lib/router/index.js:328:13)
Hello, @mathbruyen 👋. We appreciate you not only opening this issue, but providing the suspected commit as well! We'll review this internally and report back on this issue soon.
The change reduced memory increase speed, I found another leak which I am reporting under a different ticket but this one seems indeed fixed. Thank you!
@mathbruyen, that's great to hear that the one reported in this issue is resolved!
As for the new one, definitely open a new ticket and reference this issue in it please. We'll investigate the new one as soon as you do. Thank you for taking the time to report these!
Before opening, please confirm:
JavaScript Framework
Not applicable
Amplify APIs
Authentication
Amplify Categories
auth
Environment information
Describe the bug
During its creation,
Auth
class is adding a callback for being notified about framework changes (observeFrameworkChanges
). This callback is never cleared (there is no API to remove callbacks from the array) and causes a memory leak when using Auth with server side rendering as one instance is created for every request:This seem to have been introduced with 03aa356
Expected behavior
Server side rendering does not cause memory usage to continuously grow
Reproduction steps
We have a basic Express app that does the following on every request:
and then uses
Auth
to authenticate users against Cognito.Code Snippet
No response
Log output
No response
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: