viewer.camera.getPickRay is not working

My Cesium.js Version is 1.110. I get a undefined when call the function “viewer.camera.getPickRay”. And then I found
the canvas.clientWidth and clientHeight is 0. About the definition of getPickRay is: