Bug in pagination with index match when character `|` is present

const userSub = "sub google-oauth2|..." // this comes from Auth0 JWT

          q.Index("index by owner"),

this causes

{"errors":[{"position":["map","lambda"],"code":"invalid argument","description":"Lambda expects an array with 1 elements. Array contains 3."}]}

if I remove | from user sub it works, however that would break my security rules for the collection:

  Equals(CurrentIdentity(), Select(["data", "owner"], Get(Var("ref"))))

character | should not break index lookup, specially since its the sub from Auth0 JWT

Can you share the definition of your Index? And also the whole query that you are executing? The error indicates that the query contains a Map function, but I can’t tell how things are coming together.

I see that in your example, the index name is "index by owner". Is this just for providing an example? Names for resource (e.g. Collections, Indexes, Functions, etc.) cannot contain spaces. This is probably not relevant to your actual question, but I wanted to clarify for any other readers.

Here is a sample query that involves the schema used by the documentation’s examples:

> Paginate(
  Match(Index("spells_by_element"), "fire")
  data: [
    Ref(Collection("spells"), "181388642046968320"),
    Ref(Collection("spells"), "181388642071085568")

If I modify the Match term to match the one from your example:

> Paginate(
  Match(Index("spells_by_element"), "sub google-oauth2|...")
{ data: [] }

For that string, the | character is not special in any way, none of the characters in a valid JWT would be special either.

As Paul suggested, and the error message you reported, the problem is elsewhere in your query.

ok thank you both! I will keep on trying and report back thanks!

Hi @santiago were you able to get this one working? Let us know if you still have questions or this one can be closed.


I moved away from this for now. Please go ahead and close it, if I have some time in the upcoming weeks I will try to reproduce on my end with a blank project and see if it’s actually an issue worth reporting.

so feel free to close it
Thank you for the follow up @ptpaterson !

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.