Skip to content
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

[Supabase integration]: Null check exception thrown in PostgrestBuilder when upserting while being offline #439

Closed
devj3ns opened this issue Sep 13, 2024 · 3 comments

Comments

@devj3ns
Copy link
Contributor

devj3ns commented Sep 13, 2024

This morning, I tested if the app I am migrating to the new Supabase integration still works offline. Unfortunately, when I upsert a model while being offline, the following exception is thrown:

Null check operator used on a null value
#0      PostgrestBuilder._parseResponse (package:postgrest/src/postgrest_builder.dart:254:27)
#1      PostgrestBuilder._execute (package:postgrest/src/postgrest_builder.dart:164:14)
<asynchronous suspension>
#2      PostgrestBuilder.then (package:postgrest/src/postgrest_builder.dart:372:24)
<asynchronous suspension>

I checked the debugger, and the exception is thrown in this line inside the _upsertByType function of the SupabaseProvider:

final resp = await builder.select(queryTransformer.selectFields).limit(1).maybeSingle();

I can also reproduce this issue with the example_supbase flutter app. (For that, I added a button which upserts a new customer because currently the example only displays the customers but does not allow adding a new one).

@tshedor
Copy link
Collaborator

tshedor commented Sep 13, 2024

@devj3ns Good catch; fixed and merged in #436 . I haven't published this.

@devj3ns
Copy link
Contributor Author

devj3ns commented Sep 13, 2024

@tshedor, thanks! I'll do some more tests on Monday and report back if there are any other issues or bugs.

@devj3ns
Copy link
Contributor Author

devj3ns commented Sep 16, 2024

I just tested it and the exception is gone now. Thanks for the quick fix!

@devj3ns devj3ns closed this as completed Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants