Re-adding documents fails

Hello
I have tested on my environment without any issue (the document is stored and accessible in the console and from the code)
Can you print the value/code returned by each operation you are executing?
Regards