This bug is no longer reproducible in the production environment using the provided code snippet.
Run the SignInToPortal command before running the SearchCursor function for it to work. If the SearchCursor function is run before the SignInToPortal, the SearchCursor continues to fail even after the SignInToPortal function is run (restarting the kernel resets the session and fix this issue).
解决办法
Share the feature service publicly.
Use a different Python IDE, such as ArcGIS Pro, ArcMap, IDLE, or Jupyter Notebooks.