Object has no mesh data to be used for ray casting

In Blender 2.8 the object must be evaluated by the depsgraph first:

obj_eval = depsgraph.objects.get(target_obj.name, None)  
if obj_eval:
    success, hit, normal, index = obj_eval.ray_cast(ori, ray_dir)