JSON type filter query works in development, but gives me "status": 500" in prod

System Information
  • Strapi Version:
  • Operating System:
  • Database:
  • Node Version:
  • NPM Version:
  • Yarn Version:

Hello all,

I am building a forum with Strapi as backend and experiencing a weird bug.
In my collection i have 1 JSON type where i perform the following successful query in development.

[(http://AwsEc2Endpoint:1337/api/threads?filters[tags][$contains]=${tag})

This line goes through all my threads and give me back the threads that have that tag. The JSON type is array with each type as string and every threads has tags, standard forum stuff.

This is working in development, but when i build the projects and start them in EC2 instance (backend Strapi + front with Next), this query returns => “status”: 500, “name”: “InternalServerError”.

Has somebody encountered this problem or has any idea where is the issue coming from? Been stuck on it for 2 days and would appreciate some pointers. Cheers

EDIT - changed from SQlite in dev to Postgres in prod

Founds the answer for the next people who have this problem…
I changed the [$contains] to [$containsi] (with added i for case sensitive) and this fixed it.

1 Like

Thank you. Seems like $contains is bugged on postgres. When i use it on a component relationship i get this error:

"error": {
    "status": 500,
    "name": "InternalServerError",
    "message": "Error fetching content",
    "details": {
      "length": 202,
      "name": "error",
      "severity": "ERROR",
      "code": "42883",
      "hint": "No operator matches the given name and argument types. You might need to add explicit type casts.",
      "position": "342",
      "file": "parse_oper.c",
      "line": "647",
      "routine": "op_error"
    }
  }

Log (content type: Event list with component with multiselect field call ‘content_visibiity’):

 error: Error fetching content select distinct "t0".*, "t0"."id" from "public"."event_lists" as "t0" left join "public"."event_lists_components" as "t1" on "t0"."id" = "t1"."entity_id" and "t1"."field" = $1 left join "public"."components_filters_schema_filters_schemas" as "t2" on "t1"."component_id" = "t2"."id" where (("t0"."locale" = $2 and (("t2"."content_visibility" like $3)))) - operator does not exist: jsonb ~~ unknown

Changing my filter operator from $contains to $containsi worked.