0

I have a discord bot written in TS and running on node. When I deploy my code, the bot doesn't start but I can go to the Azure console and start via npm there. At this point, the bot is online and working as expected. However, after 60 seconds the console give an error and the bot is offline again. How can I add the node dist/app.js command as part of the deployment process so I don't have to start it from the console? below is my package.json

{
  "name": "d-app",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\"",
    "start": "node dist/app.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@types/node": "^14.0.23",
    "discord-akairo": "github:1Computer1/discord-akairo",
    "discord.js": "github:discordjs/discord.js",
    "i": "^0.3.6",
    "ms": "^2.1.2",
    "sqlite3": "^5.0.0",
    "twilio": "^3.51.0",
    "typeorm": "^0.2.25"
  }
}

web.config on root directory

<?xml version="1.0" encoding="utf-8"?>

<configuration>
  <system.webServer>
    <webSocket enabled="false" />
    <handlers>
      <!-- Indicates that the server.js file is a node.js site to be handled by the iisnode module -->
      <add name="iisnode" path="dist/app.js" verb="*" modules="iisnode"/>
    </handlers>
    <rewrite>
      <rules>
        <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
          <match url="^dist/app.js\/debug[\/]?" />
        </rule>

        <rule name="StaticContent">
          <action type="Rewrite" url="public{REQUEST_URI}"/>
        </rule>

        <rule name="DynamicContent">
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
          </conditions>
          <action type="Rewrite" url="dist/app.js"/>
        </rule>
      </rules>
    </rewrite>

    <security>
      <requestFiltering>
        <hiddenSegments>
          <remove segment="bin"/>
        </hiddenSegments>
      </requestFiltering>
    </security>

    <httpErrors existingResponse="PassThrough" />
    
    <iisnode watchedFiles="web.config;*.js"/>
  </system.webServer>
</configuration>

Error from console file structure

0 Answers0