Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

funcpack errors when requiring Sequelize #86

Open
jcoronel94 opened this issue Jul 24, 2018 · 1 comment
Open

funcpack errors when requiring Sequelize #86

jcoronel94 opened this issue Jul 24, 2018 · 1 comment

Comments

@jcoronel94
Copy link

Packing function project results in error only when trying to pack Sequelize and its dependencies. If I ignore sequelize the packing complete successfully but obviously wont be able to find Sequelize. Any workarounds for this?

info: Generating project files/metadata
info: Webpacking project
error: Hash: 7a7e2c7850a21f5380f4
Version: webpack 3.5.6
Time: 6230ms
   Asset     Size  Chunks                    Chunk Names
index.js  3.59 MB       0  [emitted]  [big]  main
   [9] external "path" 42 bytes {0} [not cacheable]
 [101] ./node_modules/express/lib/middleware/query.js 885 bytes {0} [built]
 [108] ./node_modules/azure-function-express/lib/ExpressAdapter.js 3.87 kB {0} [built]
 [267] ./.funcpack/index.gen.js 68 bytes {0} [built]
 [268] ./Projects/index.js 5.28 kB {0} [built]
 [269] ./node_modules/express/index.js 224 bytes {0} [built]
 [270] ./node_modules/express/lib/express.js 2.31 kB {0} [built]
 [335] ./node_modules/serve-static/index.js 4.57 kB {0} [built]
 [336] ./node_modules/azure-function-express/lib/index.js 708 bytes {0} [built]
 [337] ./node_modules/azure-function-express/lib/createAzureFunctionHandler.js 753 bytes {0} [built]
 [340] ./node_modules/azure-function-express/lib/IncomingMessage.js 3.88 kB {0} [built]
 [341] ./Projects/fac-master-models/index.js 3.03 kB {0} [built]
 [342] ./node_modules/sequelize/index.js 116 bytes {0} [built]
 [343] ./node_modules/sequelize/lib/sequelize.js 49.6 kB {0} [built]
 [531] ./Projects/config/config-fac-master.js 727 bytes {0} [built]
    + 517 hidden modules

WARNING in ./node_modules/sequelize/lib/dialects/mssql/connection-manager.js
21:19-62 Critical dependency: the request of a dependency is an expression

WARNING in ./node_modules/sequelize/lib/dialects/postgres/connection-manager.js
22:16-59 Critical dependency: the request of a dependency is an expression

WARNING in ./node_modules/sequelize/lib/dialects/sqlite/connection-manager.js
25:19-62 Critical dependency: the request of a dependency is an expression

WARNING in ./node_modules/sequelize/lib/dialects/mysql/connection-manager.js
32:19-62 Critical dependency: the request of a dependency is an expression

WARNING in ./node_modules/sequelize/lib/sequelize.js
393:61-74 Critical dependency: the request of a dependency is an expression

WARNING in ./node_modules/express/lib/view.js
81:13-25 Critical dependency: the request of a dependency is an expression

WARNING in ./node_modules/sequelize/lib/dialects/mysql/connection-manager.js
Module not found: Error: Can't resolve 'mysql2' in 'C:\Users\U1119856\Documents\azure-consumption\GCFunctions-Api\node_modules\sequelize\lib\dialects\mysql'
 @ ./node_modules/sequelize/lib/dialects/mysql/connection-manager.js 34:19-36
 @ ./node_modules/sequelize/lib/dialects/mysql/index.js
 @ ./node_modules/sequelize/lib/sequelize.js
 @ ./node_modules/sequelize/index.js
 @ ./Projects/fac-master-models/index.js
 @ ./Projects/index.js
 @ ./.funcpack/index.gen.js

WARNING in ./node_modules/sequelize/lib/dialects/sqlite/connection-manager.js
Module not found: Error: Can't resolve 'sqlite3' in 'C:\Users\U1119856\Documents\azure-consumption\GCFunctions-Api\node_modules\sequelize\lib\dialects\sqlite'
 @ ./node_modules/sequelize/lib/dialects/sqlite/connection-manager.js 27:19-37
 @ ./node_modules/sequelize/lib/dialects/sqlite/index.js
 @ ./node_modules/sequelize/lib/sequelize.js
 @ ./node_modules/sequelize/index.js
 @ ./Projects/fac-master-models/index.js
 @ ./Projects/index.js
 @ ./.funcpack/index.gen.js

WARNING in ./node_modules/sequelize/lib/dialects/mssql/connection-manager.js
Module not found: Error: Can't resolve 'tedious' in 'C:\Users\U1119856\Documents\azure-consumption\GCFunctions-Api\node_modules\sequelize\lib\dialects\mssql'
 @ ./node_modules/sequelize/lib/dialects/mssql/connection-manager.js 23:19-37
 @ ./node_modules/sequelize/lib/dialects/mssql/index.js
 @ ./node_modules/sequelize/lib/sequelize.js
 @ ./node_modules/sequelize/index.js
 @ ./Projects/fac-master-models/index.js
 @ ./Projects/index.js
 @ ./.funcpack/index.gen.js

ERROR in ./node_modules/sequelize/lib/dialects/postgres/hstore.js
Module not found: Error: Can't resolve 'pg-hstore' in 'C:\Users\U1119856\Documents\azure-consumption\GCFunctions-Api\node_modules\sequelize\lib\dialects\postgres'
 @ ./node_modules/sequelize/lib/dialects/postgres/hstore.js 3:15-35
 @ ./node_modules/sequelize/lib/dialects/postgres/data-types.js
 @ ./node_modules/sequelize/lib/data-types.js
 @ ./node_modules/sequelize/lib/sequelize.js
 @ ./node_modules/sequelize/index.js
 @ ./Projects/fac-master-models/index.js
 @ ./Projects/index.js
 @ ./.funcpack/index.gen.js

ERROR in ./node_modules/pg/lib/native/client.js
Module not found: Error: Can't resolve 'pg-native' in 'C:\Users\U1119856\Documents\azure-consumption\GCFunctions-Api\node_modules\pg\lib\native'
 @ ./node_modules/pg/lib/native/client.js 10:13-33
 @ ./node_modules/pg/lib/native/index.js
 @ ./node_modules/pg/lib/index.js
 @ ./node_modules/sequelize/lib/dialects/postgres/connection-manager.js
 @ ./node_modules/sequelize/lib/dialects/postgres/index.js
 @ ./node_modules/sequelize/lib/sequelize.js
 @ ./node_modules/sequelize/index.js
 @ ./Projects/fac-master-models/index.js
 @ ./Projects/index.js
 @ ./.funcpack/index.gen.js

ERROR in ./node_modules/sequelize/lib/dialects/mssql/query.js
Module not found: Error: Can't resolve 'tedious' in 'C:\Users\U1119856\Documents\azure-consumption\GCFunctions-Api\node_modules\sequelize\lib\dialects\mssql'
 @ ./node_modules/sequelize/lib/dialects/mssql/query.js 10:14-32
 @ ./node_modules/sequelize/lib/dialects/mssql/index.js
 @ ./node_modules/sequelize/lib/sequelize.js
 @ ./node_modules/sequelize/index.js
 @ ./Projects/fac-master-models/index.js
 @ ./Projects/index.js
 @ ./.funcpack/index.gen.js
(node:9716) UnhandledPromiseRejectionWarning: Error: Could not webpack project
    at Command.<anonymous> (C:\Users\U1119856\AppData\Roaming\npm\node_modules\azure-functions-pack\lib\main.js:158:19)
    at Generator.throw (<anonymous>)
    at rejected (C:\Users\U1119856\AppData\Roaming\npm\node_modules\azure-functions-pack\lib\main.js:6:65)
    at <anonymous>
(node:9716) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function
without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:9716) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
@harshithkashyap
Copy link
Contributor

harshithkashyap commented Jul 27, 2018

@jcoronel94 You need to add the following modules into funcpack.config.json at your project root.

{
    "ignoredModules": [
        "pg",
        "sqlite3",
        "mysql2",
        "pg-hstore"
    ]
}

We are using MSSQL dialect and hence package tedious hasn't been added to the above list. Update this accordingly to the dialect you are using.
Also, if your function app relies on associations defined in the models, you'll run into issues there as well.
We have dropped Azure Functions pack and switched to RUN_FROM_ZIP kudu feature. This is working well for us. We also get correct stack traces when looking at error logs as its not bundled anymore.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants