I’m new to this, and I have to admit I’m not a pro on node.js.
So long things short, I had a bot (a translator) working in heroku, and now I moved it to fly.io.
It is working, but duplicates it’s actions (sends 2 translations to each language), and I believe it still uses Heroku Postgrees DB, so I decided to upload a new instance (the DB only holds the channels config, so not to worry about losing it and do it again).
The problem is, altho it gets the bot online, it doesn’t respond to the commands i put in discord, so I assume it is not communicating.
I have the secrets set, but not sure it is the right way (I did as docs explain).
One thing I’ve noted is that you set the env values as these strings so DATABASE_URL is literally "process.env.DATABASE_URL" rather than your secret. I’d say remove those two from the [env] section and use only secrets for these. That might be able to help.
I’m not used to discord bots at all but I assume it uses webhooks? Have you tried changing the webhook to hit your new URL from Fly? Looking into logs might be a nice place to start debugging
In case it uses longpolling that might explain why it replied twice as having two concurrent instances would make both of them get updates on a near time frame and both would reply thinking they are the only one doing it. But assuming it is using this method you might also want to look into logs to see if there’s nothing else happening.
I updated dependencies and been trying it out as I go in VSC (locally).
It is working on my computer, so I believe it means there are no errors stopping it from working, but it doesn’t work in Fly.io.
The simptoms are the same, it just doesn’t work, no errors or anything.
The only diference is the heroku:buildpack20 … Whitch was also used in Heroku … I’m lost at this point.
I used a Docker and let it build in debian:bullseye … here I got an error about missing gulp, but running locally, it works:
The bot coundn’t connect to the FLY Postgres DB, and as I don’t have a time out set to the DB connection (because I don’t want the bot to stop running if it fails, as it can run with the cached data), it never gave any errors.
I have the bot hosted and working in Fly, connected to the Postgres Database in Heroku for about a week now.
Now I have to understand why the Fly DB doesn’t allow the bot to connect to it with both internal and external URLs (I had setup an external connection, and I can connect with TablePlus).
I could use some tips on FLY postgrees DB … anyway, I will come back once and if I solve it.