Comments (8)
I did. But seems the network inspector can not detect the request in v0.6, it can detect the request in v1+. I think the network inspector can not detect the request that is executed in the native code.
I'm more interested in the amount of requests being sent from your V1 project. It's easiest to grab that info from web if you have that platform enabled in your project. Let us know how many requests you see and we can continue to debug.
It means the lib always performs a network request for the user's information. correct?
Correct. This is by design. You're welcome to cache it yourself, as we will always fetch from remote when you call the API.
btw, can we change the limitation (120 requests per sec) to a higher value?
Where are you seeing this limit?
from amplify-flutter.
Hi @mettamdaica0909, sorry to hear you ran into an issue during migration.
Can you confirm if you're using the Authenticator UI component? Or are you using the Auth category directly?
from amplify-flutter.
I'm using the Auth category directly. I checked both version and seem there's an update for the fetchUserAttributes function.
Ver 0.6.0
@override
Future<List<AuthUserAttribute>> #fetchUserAttributes(
{FetchUserAttributesRequest? request}) async {
try {
final List<Map<dynamic, dynamic>>? data =
(await (_channel.invokeListMethod(
'fetchUserAttributes',
<String, dynamic>{
'data': request != null ? request.serializeAsMap() : {},
},
)));
if (data == null)
throw AmplifyException(
AmplifyExceptionMessages.nullReturnedFromMethodChannel);
return formatFetchAttributesResponse(data);
} on PlatformException catch (e) {
throw castAndReturnPlatformException(e);
}
}
Ver 1.6.1
Future<List<AuthUserAttribute>> fetchUserAttributes({
FetchUserAttributesOptions? options,
}) async {
final tokens = await stateMachine.getUserPoolTokens();
final resp = await _cognitoIdp
.getUser(
cognito.GetUserRequest(
accessToken: tokens.accessToken.raw,
),
)
.result;
return [
for (final attributeType in resp.userAttributes)
attributeType.asAuthUserAttribute,
];
}
My understanding is 1.6.1 version is hitting the server for the attributes via cognito.GetUserRequest. is that correct?
from amplify-flutter.
Hi @mettamdaica0909, that's a correct observation, the implementation has changed between major versions.
In v0.6, we were calling into the native platform libraries to perform the API call. For example, on iOS devices the Amplify Swift library would handle to request through the method channel.
In v1+, we perform the entire fetchUserAttributes()
call in Dart using Amplify Flutter's Dart API category.
There is also no cache. Each call to the API will perform a network request. This was also the behavior in V0.6.
As for the error you're seeing, I can not reasonably reproduce it. If I throw fetchUserAttributes()
in a loop and call it 100 times, they all succeed. Bumping that number up to 500 I start to see failures. In either case, that amount of calls seems unlikely in a normal app.
I suspect something else is going on. Can you confirm the following:
- Using a network inspector, how many requests are made before you see this exception?
- Does this happen on any device/OS?
- Can you reproduce it on a fresh project? If so, please provide the reproduction steps.
from amplify-flutter.
Hi @Equartey, Thanks for your quick response.
Using a network inspector, how many requests are made before you see this exception?
-> I did. But seems the network inspector can not detect the request in v0.6, it can detect the request in v1+. I think the network inspector can not detect the request that is executed in the native code.
There is also no cache. Each call to the API will perform a network request. This was also the behavior in V0.6.
-> It means the lib always performs a network request for the user's information. correct?
from amplify-flutter.
btw, can we change the limitation (120 requests per sec) to a higher value?
from amplify-flutter.
Related Issues (20)
- How to set Public Read while uploading to files to aws. HOT 3
- [amplify_auth_cognito] type 'FetchAuthSessionFetching' is not a subtype of type 'FetchAuthSessionSuccess' in type cast HOT 3
- Feature Request: Sharing authentication state between apps from the same developer HOT 9
- How to call Admin Queries API with authorization? HOT 1
- S3 access denied when making the API call. HOT 2
- No way to send unconfirmed user confirmation email when they restart the app HOT 5
- DataStore sync on Android physical devices takes very long time HOT 7
- Initial DataStore Sync Slow for Android Devices HOT 4
- AmplifyPushNotificationsPinpoint doesn't support offline configuration HOT 3
- Stuck in WebUI after authenticating with a certificate in iOS HOT 16
- Type comparison with UnderlyingExceptions might not be working as expected. HOT 8
- Update device_info_plus dependency HOT 2
- Update connectivity_plus dependency HOT 1
- Datastore without Cloud sync - Android build failing HOT 6
- Unable to get local issuer certificate when configure Amplify on Windows Devices HOT 8
- User cancelled OAuth flow error from signInWithRedirect
- Amplify confirm sign in with custom authentication flow timing out HOT 1
- Unauthorized error when Data-specific Authorization with AppSync (Datastore/GraphQL) HOT 6
- Flutter Web AmplifyAuthCognito SignOut not working HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amplify-flutter.