Make MySQL query in a Forge App

Simon Larson
Contributor
August 29, 2022

Hi, I'm developing an app for our cloud hosted Jira instance using Forge. I'm trying to connect the app to a MySQL database and pull + display some relevant information next to our tickets. I have MySQL server running in a Docker instance (everything with CLI).

Is that even possible? If so, how would it best be solved?

Right now I have a piece of code that tries to connect to the database after I press a button in the app. I get no errors and no response from the database (from what I can tell).

I can make MySQL queries using command line by connecting remotely using SSH.

This is my dbconnection.js located in 'src' folder, same as 'index.jsx':

(The settings provided in "pool" is randomized for privacy)

db.png

And this is how index.jsx looks like (slightly simplified):

index.png

Feels like I'm missing something critical. Would be greatly appreciative of any response!

1 answer

2 votes
Oliver Siebenmarck _Polymetis Apps_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 29, 2022

Hi @Simon Larson ,

By default, Forge's runtime is pretty locked down. You have to explicitly allow communications with the outside world, see here: https://developer.atlassian.com/platform/forge/runtime-egress-permissions/ 

Also, you will typically better answers to dev questions in the developer community. 

I must admit, I have not tried connecting directly to a backend database, but it looks intriguing. If you make it work, please let me and other know, because I'm sure a lot of devs would be interested.

Cheers,
 Oliver

Simon Larson
Contributor
August 29, 2022

Thanks for your reply @Oliver Siebenmarck _Polymetis Apps_.

I had a hunch this method was not the norm, but I will definitely play around with the link you provided and see if we can make something work.

What would be a more standard approach to allow for implicit app storage?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events