[Error] attempt to compare userdata with number

Last week I have installed EE version and working fine till today but today morning while creating new router from GUI 8002 port getting error which states that attempt to compare userdata with number.
I verified debug logs but did not find any relevant info then restarted my kong-ee instance even kong is not up… Kong completely down.

This issue blocking our business journey, we just integrated one API as part of our POC.

Thanks in advance.

init_by_lua error: /usr/local/share/lua/5.1/kong/core/handler.lua:139: attempt to compare userdata with number
2019-05-16T05:42:08.968431100Z stack traceback:

Hi Rahul, what version of Kong EE are you using? Also would you please share what APIs, Services and Routes being stored in Kong DB. You may have to log into DB and run following query on kong schema

select * from services;
select * from routes;
select * from apis; #(only if you using APIs object for routing)

I think you ran into this issue https://github.com/Kong/kong/issues/4254, we have fixed it and would be released with Kong EE 0.35 in a week or so. A way around would be updating the column regex_priority from routes table to 0 where its null.

UPDATE routes SET regex_priority = 0 where regex_priority is null;