Are you sure it is not a permission issue?
Also, in production. is there only a warning or also an error? How does it fail?
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP