Home > Enterprise >  Error on Windows Azure App Service: Please install sqlite3 package manually
Error on Windows Azure App Service: Please install sqlite3 package manually

Time:10-24

I've run into a roadblock trying to get my web app to run on a Windows Azure App Service.

My app has a Node.js/Express back-end written in TypeScript (compiled with tsc, not Webpack) and uses Sequelize to connect to a SQLite 3 database, stored locally. The front-end is a React app built on Create React App.

The problem is that when sequelize tries to require sqlite3, a MODULE_NOT_FOUND error occurs, causing sequelize to throw a "Please install sqlite3 package manually". (See full stack trace below.)

The sqlite3 folder with the expected files is clearly present in the node_modules folder in the Azure file system, so I really don't get how require("sqlite3") could be failing.

Here's what I've tried so far:

  1. I tried pretty much every suggestion in this sequelize issue.
  2. I searched StackOverflow, but most of the questions relate to Electron, which I'm not using. Nonetheless, I read most of them, and tried any of the suggestions that seemed relevant.
  3. I made sure the version of node on my development machine is the same as on my Azure Window App Service (14.16.0).
  4. I tried deleting the node_modules folder and running npm install --production using the Azure console.
  5. I tried running npm rebuild from the Azure console.
  6. I tried running npm cache verify from the Azure console.
  7. I tried globally installing sqlite3 using npm install -g sqlite3 from the Azure console, but that action was forbidden by Azure.
  8. I tried installing sqlite3 from the source using npm install sqlite3 --build-from-source.
  9. I added console log statements to node_modules/sequelize/lib/dialects/abstract/connection-manager.js to verify that the module name passed to the require statement was "sqlite3", and it was.
  10. I tried replacing moduleName with the actual string, "sqlite3".
  11. I checked to make sure all the sqlite3 files in my App Service file listing matched the ones installed on my development machine.
  12. I probably tried a lot of other things I'm not remembering right now!

Needless to say, none of these things made any difference. Every time I checked the logs, the error was the same (and I checked the timestamps to make sure the logging system was actually working.)

Here is the full stack trace:

Error: Please install sqlite3 package manually

  • at ConnectionManager._loadDialectModule (C:\home\site\wwwroot\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:84:23)
  • at new ConnectionManager (C:\home\site\wwwroot\node_modules\sequelize\lib\dialects\sqlite\connection-manager.js:24:21)
  • at new SqliteDialect (C:\home\site\wwwroot\node_modules\sequelize\lib\dialects\sqlite\index.js:15:30)
  • at new Sequelize (C:\home\site\wwwroot\node_modules\sequelize\lib\sequelize.js:340:20)
  • at new Sequelize (C:\home\site\wwwroot\node_modules\sequelize-typescript\dist\sequelize\sequelize\sequelize.js:16:9)
  • at getSequelize (C:\home\site\wwwroot\getDatabaseInfo.js:33:16)
  • at Object.getDatabaseInfo [as default] (C:\home\site\wwwroot\getDatabaseInfo.js:15:23)
  • at Object. (C:\home\site\wwwroot\server.js:55:47)
  • at Module._compile (internal/modules/cjs/loader.js:1063:30)
  • at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
  • at Module.load (internal/modules/cjs/loader.js:928:32)
  • at Function.Module._load (internal/modules/cjs/loader.js:769:14)
  • at Module.require (internal/modules/cjs/loader.js:952:19)
  • at Module.patchedRequire [as require] (C:\PROGRA~2\SITEEX~1\APPLIC~1\28F926~1.41\nodejs\node_modules\diagnostic-channel\dist\src\patchRequire.js:15:46)
  • at require (internal/modules/cjs/helpers.js:88:18)
  • at Object. (C:\Program Files (x86)\iisnode\interceptor.js:459:1)

What else can I try?

CodePudding user response:

This is not a terribly satisfying answer, but I tried creating a brand new Windows Azure App Service and deploying to it, and the issue did not occur.

I'm guessing this means the original App Service was either caching something or had become corrupted in some way, but I'm not sure.

Next step will be to see if I can figure out a way to revert the broken App Service to its original default state, redeploy to it, and see if it works.

Edit See this question.

  • Related