There are two issues with your code. The first one is preventing the contract to be deployed: you must pass the "from" address whenever you send a transaction to the blockchain (as opposed to a call). So, the instantiation should look like this:
myContract.new("0x20...31", "0x20...65", { from: provider.getAddress() })
The other issue is that you are not listening to the first response you'll get, which is the txHash. That response will come much earlier than the contract's instance. So, even after you add the "from" address, it will still look like nothing is happening because you're waiting for the deploy to be mined.
In order for you to get this first response, you should add the following:
.once('transactionHash', function(hash) {
console.log("TxHash: " + hash);
})
That should happen pretty fast, and then you can wait another 30 seconds or so to get the result you expect.
The final code is:
const Web3 = require('web3');
const HDWalletProvider = require("@truffle/hdwallet-provider");
require('dotenv').config();
const provider = new HDWalletProvider(process.env.PRIVATE_KEY, process.env.INFURA_URL);
const contract = require('@truffle/contract');
const artifacts = require('./../contracts/Insurer.json');
var myContract = contract(artifacts);
myContract.setProvider(provider);
myContract.new("0x20202020202020202020204931303031", "0x20202020202020202020436f66616365", { from:provider.getAddress() })
.once('transactionHash', function(hash) {
console.log("TxHash: " + hash);
}).then(function(instance) {
return instance.getInsurerInfo.call()
}).then(function(result) {
console.log(result[0], result[1]);
}, function(error) {
console.log(error);
});
Note that I'm using a private key instead of a mnemonic to setup the HDWallet provider, but that should make no difference. Also, I'm using the updated versions of @truffle/hdwallet-provider and @truffle/contract, but I do think that's irrelevant too.
Also how can I debug Node code without being able to use the console?
Try nodemon. That's what I'm using, it prints just fine.
Hope it helps.