When trying to connect to SQL Server, I get the following error:
[Nest] 96151 - 30/07/2021 18:28:34 ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)...
ConnectionError: Failed to connect to XXXXXX:1433 - self signed certificate*
My ormconfig.json:
{
"type": "mssql",
"host": "localhost",
"port": 1433,
"username": "user",
"password": "pass",
"database": "BDname",
"entities": ["dist/**/*.entity{.ts,.js}"],
"synchronize": true
}
add this line to your code in typeorm config. options: { encrypt: false }
your config code would be something like this:
type: 'mssql',
host: 'localhost',
port: 1433,
username: 'sa',
password: '@Yourpassword123',
database: 'yourdatabase',
autoLoadEntities: true,
synchronize: true,
options: { encrypt: false },
I used "sa" as user because its default user name for sql server. Adapt the code config above as you need!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With