Search code examples
node.jsazureazure-api-apps

Azure API App Node.js deployment issues


I'm testing Azure API App service with a Node.js (Express, Swaggerize, Sequelize and SQLlite). So far, everything is working in my development workstation, but I bumping into some issues when trying to deploy the app.

First, I created the API App "container" and I've connected my VSTS Git repo with the API container. Everything works well when pushing code to the repo (automatically the container gets all the changes in few seconds).

But... (question(s) following)

  1. How can I resolve my Node dependencies? (so far, I've been invoking "npm install" manually through container console. I don't want to push my packages in the GIT repo
  2. I cannot use SQLite dialect in sequelize because although the package seems to be inside of my app dependencies and in the node_modules directory, my apps still throws an exception

    Wed Mar 02 2016 16:57:16 GMT+0000 (Coordinated Universal Time): Unaught exception: Error: Please install sqlite3 package manually
    at new ConnectionManager (D:\home\site\wwwroot\node_modules\sequelize\lib\dialects\sqlite\connection-manager.js:24:11)
    at new SqliteDialect (D:\home\site\wwwroot\node_modules\sequelize\lib\dialects\sqlite\index.js:12:28)
    at new Sequelize (D:\home\site\wwwroot\node_modules\sequelize\lib\sequelize.js:213:18)
    at Object.<anonymous> (D:\home\site\wwwroot\app\models\index.js:8:17)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (D:\home\site\wwwroot\app\app.js:11:14)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (D:\home\site\wwwroot\server.js:3:1)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    

Is there something that I'm missing?


Solution

  • It seems that the issue was caused by missing the npm package sqlite3. So you need to install the package manually, but the installation will be failed because the installation for package sqlite3 need gyp compiler (according to the description of the package here) that not support on Azure App Service.

    You can refer to the section Native Modules of the doc Using Node.js Modules with Azure applications to know the reason and how to work around.