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.
Otherwise…
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.
Also, I removed the bot backup instances, migrated from Heroku, to ease the troubleshooting.
The bot uses it’s token (DISCORD_TOKEN) to communicate, and it does appear online (before deploying it was offline) but it still does not respond to any command!
I checked the logs, there are no errors in there and it returns 1 Shard online and 6 guilds.
It appears to be restarting: “Shutting down virtual machine”.
Since I don’t see any message saying it ran out of memory my next best guess is that your entry point (the command that runs on docker) is exiting after running can you verify that?
I will be troubleshooting as I go, as I do it as a hobby I might take a little longer
Is it possible to have something to do with outdated or deprecated dependencies?
As it runs on Heroku and works when imported from there, I wasn’t assuming it might be the issue.
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.