-
Notifications
You must be signed in to change notification settings - Fork 275
Open
Labels
GraphQL APIIssues related to the API (GraphQL) CategoryIssues related to the API (GraphQL) CategoryiOSIssues specific to the iOS PlatformIssues specific to the iOS PlatformquestionA question about the Amplify Flutter librariesA question about the Amplify Flutter libraries
Description
Description
ModelQueries.list response does not return sometimes. I am able to get the right values like 10% of the time, rest of the time there is no reply and no logs to debug this issue.
Categories
- Analytics
- API (REST)
- API (GraphQL)
- Auth
- Authenticator
- DataStore
- Notifications (Push)
- Storage
Steps to Reproduce
My Schema:
Goal: a
.model({
direction: a.enum(["INCREASE", "DECREASE"]),
from: a.float(),
to: a.float(),
vitalId: a.id().required(),
vital: a.belongsTo("Vital", "vitalId"),
eventId: a.id().required(),
event: a.belongsTo("Event", "eventId"),
})
.authorization((allow) => [allow.owner()]),
// Vitals Related
StandardVital: a
.model({
name: a.string(),
vitals: a.hasMany("Vital", "standardVitalId"),
})
.authorization((allow) => [
allow.authenticated().to(["read"]),
allow.group("Admin"),
]),
CustomVital: a
.model({
name: a.string(),
vitals: a.hasMany("Vital", "customVitalId"),
})
.authorization((allow) => [allow.owner()]),
Vital: a
.model({
standardVitalId: a.id(),
standardVital: a.belongsTo("StandardVital", "standardVitalId"),
customVitalId: a.id(),
customVital: a.belongsTo("CustomVital", "customVitalId"),
goalId: a.id(),
goal: a.hasOne("Goal", "vitalId"),
vitalMeasurementLogs: a.hasMany("VitalMeasurementLog", "vitalId"),
})
.authorization((allow) => [allow.owner()]),
My Query:
try {
final request = ModelQueries.list(
Goal.classType,
where: Goal.EVENT.eq(event.id),
);
final response = await Amplify.API.query(request: request).response;
if (response.hasErrors) {
safePrint('errors: ${response.errors}');
return [];
}
final goals = response.data?.items ?? <Goal?>[];
return goals;
} on Exception catch (e) {
safePrint(e);
rethrow;
}
For some reason - I don't get response. When I try to debug, the code does flow through after final response = await Amplify.API.query(request: request).response;. There are no logs in VSCode and there are no exceptions that are thrown.
No Idea what is happening.
I am creating this object using:
// Create Vital
final newVital = Vital(id: uuid(), standardVital: standardVital);
final vitalRequest = ModelMutations.create(newVital);
final vitalResponse =
await Amplify.API.mutate(request: vitalRequest).response;
if (vitalResponse.data == null) {
throw Exception("Goal Creation Failed");
}
final newlyCreatedVital = (await Amplify.API
.query(
request: ModelQueries.get(
Vital.classType, vitalResponse.data!.modelIdentifier))
.response)
.data;
// Create Goal
final newGoal = Goal(
id: uuid(),
event: event,
direction: goalDirection,
vital: newlyCreatedVital,
from: from,
to: to);
final request = ModelMutations.create(newGoal);
final response = await Amplify.API.mutate(request: request).response;
Screenshots
No response
Platforms
- iOS
- Android
- Web
- macOS
- Windows
- Linux
Flutter Version
3.24.0
Amplify Flutter Version
2.0.0
Deployment Method
Amplify CLI
Schema
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
GraphQL APIIssues related to the API (GraphQL) CategoryIssues related to the API (GraphQL) CategoryiOSIssues specific to the iOS PlatformIssues specific to the iOS PlatformquestionA question about the Amplify Flutter librariesA question about the Amplify Flutter libraries