Opening, sharing, and managing OneDrive-stored documents directly within Teams
I have had the same issue and I have raised a support ticket with Microsoft about this. I have had this response from them on the 20th April 2022:
We wanted to make you aware of an issue with our SharePoint service impacting your user’s ability to submit assignments. When attempting to upload the OneDrive attachment to the assignments by Teachers/Students, users may see the following error message: "There was a problem assigning this file. Please remove and try again". We are sorry for the inconvenience and want to thank you for your patience while we mitigate this issue. Our engineering team is aware and is working on restoring service; we will update you as soon as possible. Until the service is restored, users would need to download a local copy and then upload/submit using the local copy. Below you will find the service outage message that we are also working to get posted to your service health dashboard. Again, we are sorry for the inconvenience and the disruption it caused in your school day.
This has casued nothing but issues as a computer science teacher who uses this service all the time. I am really hoping this is fixed ASAP. They did not give a timeframe for this fix.
Hope this helps anyone else with this issue.