Expect script not expecting the password prompt

I have a script that does an SSH into a remote node. It should expect the prompt and send the password.

    #!/usr/bin/expect
    
    
    set user [lindex $argv 0];
    set pass [lindex $argv 1];
    
    spawn ssh $user@E-Internal
    
    expect {
        -re "RSA key fingerprint" {send "yes\r"}
        timeout {puts "\nHost is known"}
    }
    
    expect {
        -re "(P|p)assword: " {send "$pass\r"}
         timeout {puts "Timeout error. Is device down or unreachable?? Password correct?";exit}
    }
    interact

When I run the script :

    [ruser@vm1 ~]$ /home/rsguser/scripts/git-si-repo/scripts/tunnels/itte-build-node.sh root root123
    spawn ssh root@E-Internal
    
    Host is known
    Timeout error. Is device down or unreachable?? Password correct?

Is there something I am missing ?

If I try to directly SSH, it works like :

[ruser@vm1 ~]$ ssh root@E-Internal
    root@147.128.64.212's password: 
    Last login: Sun Sep 25 00:25:31 2016 from 142.133.134.161
    [root@ecnshlx3122 ~]# 

Have you considered using SSH keys to automate the login? This would be better than trying to work around ssh with expect.

Additionally, your script is vulnerable to people reading it as your password will be visible.

The ssh design is to be secure, so you would be better to exploit that rather than to circumvent it.

Kind regards,
Robin