Frame capturing is not working

I tried with the give code it is working fine in the local html setup but with the react-container-3d it is not working please i am stuck in this problem can any one help me with this issue
this is working fine https://codepen.io/shivasaxena/pen/QEzAAv
here it is not working agitated-paper-3wke4 - CodeSandbox :frowning:

Thanks

Please any one in the community have any idea about this issue and i tried with the code pen working link it give me black screen

while initializing renderer this works fine but while updating renderer with the preserveDrawingBuffer: true it does not work