I figured it out. One of my objects was in a wrong collision mask. Hence why no data was returning.
If anyone needs it, I will plug this in here.
### get world space, port size, exclude others objects, x and y limits
var vision = get_world_2d().direct_space_state
var field = get_viewport().size
var exclude = [self, Area2D, StaticBody2D, RigidBody2D]
var head = self.global_position.y
var feet = self.global_position.x
### check for ray intersect in both directions
### first argument origin, second arg terminus, third is array for ignore
var spotting_right = vision.intersect_ray(Vector2(feet,head), Vector2(field.x,head), exclude)
var spotting_left = vision.intersect_ray(Vector2(feet,head), Vector2(0,head), exclude)
### add a gap to turning and change movement if ray intersects