# SSL error when authenticating with database

**URL:** <https://community.forestadmin.com/t/ssl-error-when-authenticating-with-database/5246>\
**Category:** Help me!\
**Created:** [September 13, 2022, 12:14pm UTC](https://community.forestadmin.com/t/ssl-error-when-authenticating-with-database/5246 "2022-09-13T12:14:18Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ayorcodes](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/ayorcodes/32/5066_2.png) [@ayorcodes](https://community.forestadmin.com/u/ayorcodes)\
**Post date:** [September 13, 2022, 12:14pm UTC](https://community.forestadmin.com/t/ssl-error-when-authenticating-with-database/5246/1 "2022-09-13T12:14:19Z")

</div>

## Feature(s) impacted

Forest admin dashboard not able to connect to the ssl database, we use typeorm for database connection

## Observed behavior

Forest admin cannot connect to the ssl enabled database

 ![Screenshot 2022-09-13 at 13.14.01](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/c/c9bd81ca2c6a3d899b5d50930afc085cbed13e65.png)

## Expected behavior

Be able to view the forest admin dashboard with the database tables

## Failure Logs

 ![Screenshot 2022-09-13 at 13.10.43](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/b/ba091954e459ecf0bb630bd21ebd522473399a1d.png)

## Context

- Project name: Spottr
- Team name: Spottr
- Environment name: Spottr
- Agent type & version:
- Recent changes made on your end if any: …

---

<div class="post-metadata">

**Author:** ![anon39940173](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@anon39940173](https://community.forestadmin.com/u/anon39940173)\
**Post date:** [September 13, 2022, 12:54pm UTC](https://community.forestadmin.com/t/ssl-error-when-authenticating-with-database/5246/2 "2022-09-13T12:54:47Z")

</div>

Hi @ayorcodes

Is this a new project?  
Where does this error comes from? your agent starting, or the forest CLI?

Which agent are you using?  
Did you use the stable agent (`forest-express-sequelize`) or the new version (`agent-nodejs@beta`) tjat we’re currently rolling out?

---

<div class="post-metadata">

**Author:** ![ayorcodes](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/ayorcodes/32/5066_2.png) [@ayorcodes](https://community.forestadmin.com/u/ayorcodes)\
**Post date:** [September 14, 2022, 4:04pm UTC](https://community.forestadmin.com/t/ssl-error-when-authenticating-with-database/5246/3 "2022-09-14T16:04:21Z")

</div>

the error comes from here  
.addDataSource(createSqlDataSource(AppConstants.TYPEORM\_URL))  
// Replace `myNestApp` by your NestJS application  
.mountOnNestJs(app)  
.start();

i am running nestjs node  
these are the packages i am using  
“@forestadmin/agent”: “^1.0.0-beta.43”,  
“@forestadmin/datasource-sql”: “^1.0.0-beta.40”,

---

<div class="post-metadata">

**Author:** ![anon39940173](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@anon39940173](https://community.forestadmin.com/u/anon39940173)\
**Post date:** [September 14, 2022, 4:32pm UTC](https://community.forestadmin.com/t/ssl-error-when-authenticating-with-database/5246/4 "2022-09-14T16:32:39Z")

</div>

Can you try appending `?ssl=true` to your database connection URI?

```javascript
createSqlDataSource(`${AppConstants.TYPEORM_URL}?ssl=true`)

```

If your database is using a self-signed certificate (common in development), you may want to use

```javascript
createSqlDataSource(`${AppConstants.TYPEORM_URL}?ssl=true&sslmode=no-verify`)

```

---

<div class="post-metadata">

**Author:** ![ayorcodes](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/ayorcodes/32/5066_2.png) [@ayorcodes](https://community.forestadmin.com/u/ayorcodes)\
**Post date:** [September 14, 2022, 4:41pm UTC](https://community.forestadmin.com/t/ssl-error-when-authenticating-with-database/5246/5 "2022-09-14T16:41:36Z")

</div>

the second options works!!! thanks  
now there is a new error  
 ![Screenshot 2022-09-14 at 17.41.23](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/e/e1f95a98618368446f58b81a311961f34b9eff8f.png)

---

<div class="post-metadata">

**Author:** ![ayorcodes](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/ayorcodes/32/5066_2.png) [@ayorcodes](https://community.forestadmin.com/u/ayorcodes)\
**Post date:** [September 14, 2022, 5:18pm UTC](https://community.forestadmin.com/t/ssl-error-when-authenticating-with-database/5246/6 "2022-09-14T17:18:41Z")

</div>

i might have figured it out, will update in a few hours

---

<div class="post-metadata">

**Author:** ![ayorcodes](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/ayorcodes/32/5066_2.png) [@ayorcodes](https://community.forestadmin.com/u/ayorcodes)\
**Post date:** [September 14, 2022, 5:24pm UTC](https://community.forestadmin.com/t/ssl-error-when-authenticating-with-database/5246/7 "2022-09-14T17:24:38Z")

</div>

![Screenshot 2022-09-14 at 18.24.13](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/8/85174cbd6a52caa38176bdc2212b4acb1d3af932.png)  
Now i get cors error on the dashbaord

---

<div class="post-metadata">

**Author:** ![anon39940173](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@anon39940173](https://community.forestadmin.com/u/anon39940173)\
**Post date:** [September 14, 2022, 5:27pm UTC](https://community.forestadmin.com/t/ssl-error-when-authenticating-with-database/5246/8 "2022-09-14T17:27:08Z")

</div>

can you `copy as curl` the failing request and run it in a terminal to get the actual error? (simply open in a new tab if its a GET request)

your browser is hiding the response because the errors does not contains cors headerss

---

<div class="post-metadata">

**Author:** ![ayorcodes](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/ayorcodes/32/5066_2.png) [@ayorcodes](https://community.forestadmin.com/u/ayorcodes)\
**Post date:** [September 14, 2022, 5:31pm UTC](https://community.forestadmin.com/t/ssl-error-when-authenticating-with-database/5246/9 "2022-09-14T17:31:26Z")

</div>

with curl i get response

---

<div class="post-metadata">

**Author:** ![ayorcodes](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/ayorcodes/32/5066_2.png) [@ayorcodes](https://community.forestadmin.com/u/ayorcodes)\
**Post date:** [September 14, 2022, 5:38pm UTC](https://community.forestadmin.com/t/ssl-error-when-authenticating-with-database/5246/10 "2022-09-14T17:38:11Z")

</div>

i’ve gotten it to work,

i changed  
`app.enableCors();initialiseForestAdmin(app);`

to

`initialiseForestAdmin(app);app.enableCors();`
