Any way to use `knex`?
See original GitHub issueCurrently trying to package knex
with pg
. This was also a problem serverless-webpack
faced but by force including the required packages it worked in the end. This is the only issue that I could find related to knex and esbuild but doesn’t seem to solve my problem.
This is the error I get when running sls package
:
# ...
Serverless: Packing external modules: knex@^0.95.4, mysql, mysql2, pg@^8.6.0, pg-native, sqlite3, tedious
Error ---------------------------------------------------
Error: npm install failed with code 1
at ChildProcess.<anonymous> (/home/arpad/workspace/sls-webpack-v-esbuild/esbuild/node_modules/serverless-esbuild/dist/utils.js:48:24)
at ChildProcess.emit (events.js:314:20)
at ChildProcess.EventEmitter.emit (domain.js:483:12)
at maybeClose (internal/child_process.js:1022:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
# ...
To note that it also tries to include mysql
, mysql2
, pg-native
, sqlite3
and tedious
and I’m not sure how I can ignore them.
And this is my config:
// ...
custom: {
esbuild: {
bundle: true,
minify: false,
external: ['knex', 'pg'],
},
},
package: {
individually: true,
},
// ...
Issue Analytics
- State:
- Created 2 years ago
- Comments:18 (9 by maintainers)
Top Results From Across the Web
Knex.js Tutorial For Beginners - Shahed Nasser
In this tutorial, you'll learn how to use Knex.js with Node.js and Express. We'll create migrations, seeders, then query and insert data ...
Read more >Knex.js: SQL Query Builder for Javascript
Knex.js is a "batteries included" SQL query builder for PostgreSQL, CockroachDB, MSSQL, MySQL, MariaDB, SQLite3, Better-SQLite3, Oracle, and Amazon Redshift ...
Read more >Knex.Js. Beginner's Guide in Examples | LITSLINK | - Medium
1. Create a package.json file in your project folder and copy-paste these lines: Run npm install in your project folder. · 2. Create...
Read more >Knex.js tutorial - programming databases with Knex.js - ZetCode
Knex.js is a JavaScript query builder for relational databases including PostgreSQL, MySQL, SQLite3, and Oracle. It can be used with callbacks ...
Read more >Use SQL Query Builder Knex.js with Node.js and Express.js
Step 1. Install Knex.js and migration CLI · Step 2. Database configuration · Step 3. Migrate using migration CLI · Step 4. Define...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yep, now it’s working perfectly!
Thanks a lot! Looking forward to an update with the PR and this will be great.
Oh sorry of course, it needs deps install and building in the node modules - you cannot try it just like that - my bad. Anyway I am pretty sure it fixes your problems. I’ll add
exclude
anyways to the mix and let’s wait for @floydspace’s input on the PR.