-
Notifications
You must be signed in to change notification settings - Fork 238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GraphQL response error on fetching user by id #4109
Comments
@haverchuck @ykethan Can you guys help, please? We are stuck in this error! |
Hi @mtalhastar, Sorry you ran into this error. If your use case is to simply fetch a single model by ID we offer a discrete API for this. Here is an example of how to construct that request given an ID as a string. Future<userType?> queryItem(String id) async {
try {
final id = userTypeModelIdentifier(id: '123');
final request = ModelQueries.get(
userType.classType,
id,
);
final response = await Amplify.API.query(request: request).response;
if (response.data == null) {
safePrint(response.errors);
}
return response.data;
} on ApiException catch (e) {
safePrint(e);
}
} The example you provided using a query predicate is typically used when fetching one or more models based on a non-id field. However, I would expect your example to work as written. If your use case requires query predicates, in order to troubleshoot the issue further, can you please provide your |
On this i receive error below: GraphQL file: |
Hi @mtalhastar, Models should follow title casing such as This subtile difference is making the underlying generated functions unable to find required properties and methods. You will need to update your model names and redeploy your backend for the Model helper functions to work. It's unclear to me at the moment if this is a bug or by design. I'm going to leaving this issue open so we can track the investigation internally. |
Cant just changing model titles in schema.graphql file work? instead of changing names in GraphQl models in amplify backend? |
@dnys1 I've seen you that you are a contributor to AWS Amplify in Flutter and I'm facing a problem for days here so can you please help? |
Hi @mtalhastar,
Apologies, I could have been more clear. You will update the model names in your |
@Equartey Why I can't directly connect my Flutter app to the already developed Amplify backend without any changes to it? If I made these changes, then the web application won't work again so I need more extra work from the web developer to fix them. |
@Equartey Can u provide an answer for my question please? I need it |
Hi @Tructivity, I've confirmed this is a bug and have opened a PR to address it. However, this likely won't get released until next week. In the meantime, the only workaround I can provide is renaming your models. Although, I realize this conflicts with wanting to preserve your backend. I will notify you here once the fix is publicly available. |
@Equartey thanks for replying, so in the next week, I will be able to connect my Flutter app with the existing backend (DynamoDB) using GraphQL without any changes to it? |
@Tructivity assuming there are no other issues with your setup, once this fix is released it should work. |
@Equartey Thanks a lot for helping me! We will leave this issue open until the release of the update and we then confirm that it is working properly. |
Hey @Tructivity We're still working on releasing a fix. However, in the meantime please consume the branch directly by adding this override to your dependency_overrides:
amplify_api_dart:
git:
url: https://github.com/aws-amplify/amplify-flutter.git
ref: 0b3672b09849290394b7a775beaccf1ec6379dbf
path: packages/api/amplify_api_dart Please let me know if you have issues setting this up. I will continue to provide updates as I have them. Thanks! |
@Equartey Thanks a lot but I can wait for a while before you release the update since we are busy with another issue! Can u please tell me when u will release the update? |
@Tructivity I will notify you when it's been released. I currently do not have an ETA. |
@Equartey 13 days I've been waiting to be fixed, hope will be fixed very soon 😞 |
@Tructivity Sorry for the delay, the fix has been released in amplify_api 1.6.2 I'm going to close this issue as resolved now. Please update your dependency and reach out if you have any additional issues. |
When i call this function from flutter app passing correct user id stored in my dynamo db as parameter , it shows me following error.
CLI v 12.7.1
Error:
here is the code snippet:
The text was updated successfully, but these errors were encountered: