SuiteScript Throwing MUTUALLY_EXCLUSIVE_ARGUMENTS Error During SFTP Connection
Published on
October 31st, 2023
Scenario
NetSuite currentlydoes not support 2FAconnections over SFTP connections.There is currently a defect on this topic tracked asDefect 569291forallowing the use of two types of authentication at the same time (2FA).
When there is a use case to send 2 types of authentication at the same time, the below code throws error MUTUALLY_EXCLUSIVE_ARGUMENTS.
var connection = sftp.createConnection({ username: 'sftpuser', passwordGuid: myPwdGuid, keyId: 'custkeysftp_1', url: '192.168.0.10', port: 22, directory: 'inbound', hostKey: 'AAAAB3NzaC1yc2EAAAADAQABAf..' });Since 2019.2 version, NetSuite started to accept the use of SSH keys for authentication.
Solution
If the use case is to test the keys, just remove the fields related to authentication by credentials (user / password). In other words, keys replace authentication with credentials.
If the use case is to use both types of authentication as 2FA (two-factor authentication), the solution to this limitation is to use a server as a bridge.