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

Invalid key name in startAt query parameter #297

Open
AchuthanR opened this issue Sep 10, 2022 · 2 comments
Open

Invalid key name in startAt query parameter #297

AchuthanR opened this issue Sep 10, 2022 · 2 comments

Comments

@AchuthanR
Copy link

AchuthanR commented Sep 10, 2022

I am using the offline database implementation. When I start streaming changes, the latest key present in the offline database is fetched and incremented in RealtimeDatabase.GetLatestKey() method and returned as I use StreamingOptions.LatestOnly. The returned string is used in the startAt="<latest-key>" query parameter.

But when the latest key is something like -NBatwr2n20T2uW3aKlZ, I get an error as the last character Z will be made \ and it can't be used just like that in the query part. This is the exception data I get:

Url: https://<project-id>-default-rtdb.firebaseio.com/<path>/.json?orderBy="$key"&startAt="-NBatwr2n20T2uW3aKl\"
Request Data:
Response: {
"error" : "Constraint key field must be a valid key name"
}

I referred to the best answer under this stackoverflow question, but no method suggested there worked.

@RPGFabi
Copy link

RPGFabi commented Sep 18, 2022

Did you implement the .indexIsOn in your FIrebase? Think it is needed for special qerrys

@AchuthanR
Copy link
Author

AchuthanR commented Sep 18, 2022

Did you implement the .indexIsOn in your FIrebase? Think it is needed for special qerrys

Firebase automatically indexes its children based on keys. So, no need to specify it explicitly. But, anyway, I tried it just now and it doesn't seem to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants