Welcome!
First of all, yes this is the right place to post this to and also its okay to post the code here.
Unfortunately, a lot of code is missing, you should probably post your whole code, so we can see, if there might be issues with connecting etc.
Make sure to remove your oauth tokens/passwords/private information before posting any code