Deployment failed - Twitter bot with Javascript

I built a Twitter bot with Javascript after pushing to git, and deployment is in progress. The bot works, but after a while, it shows “deploy failed”, which eventually stops the bot from responding.

Screenshot 2023-01-04 at 00.06.11

Logs didn’t show any error.

Here is the code to the repository

My question is:

  • Is there a thing stopping my service from running?
  • Does the upgrading plan fix this?

Help, please!

Hey there :slight_smile:

Updgrading the plan shouldn’t be a factor. It should work on free tier.
When you click the deployment, what do the logs show? I know you said there werent’ errors but something must be happening behind the scenes.

That is exactly what I thought, too, but there is no error.

There is something I noticed, though. In the application, I logged a message “Server started on port …” that message didn’t show up on the log, making me feel it’s breaking somewhere, but it works fine on the localhost and Heroku. @bergur

Any help/suggestion @admins ??

In that case the server is most likely not starting.
What port are you running on? You should use process.env.PORT (10000 is what render uses)

So in your code if you have something like

app.listen(3000, () => {
  console.log('server running on port 3000)

change it to

const port = process.env.PORT || 3000
app.listen(port, () => {
  console.log('server running on port ' + port)

So when the port is not defined it defaults to 3000 (or whatever port you were using) but in an environment where port is defined (like at render) it uses that.


Hi there,

The suggestions from Bergur, above, seem like a good place to start.


@bergur wow, it works now.

Screenshot 2023-01-04 at 14.41.10

I think it has to do with the port issue. Thanks for your help.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.