Again, not an expert (I have not run into this issue before, and develop in Motoko), but if you look at the logging you provided, your optimized wasm size is 500KB (less than the limit), and the wasm you’re trying to upload is still over 2MB.
Maybe try following the instructions in this thread - Http Error: status 413 Payload Too Large