Comments (11)
I have same issue
Sequelize CLI [Node: 12.16.1, CLI: 5.5.1, ORM: 5.22.3]
Loaded configuration file "config\config.json".
Using environment "development".
ERROR: Error parsing url: undefined
from cli.
@ArthurGuez So in the intial example:
production: {
use_env_variable: process.env.DATABASE_URL,
dialect: 'postgres',
dialectOptions: {
ssl: {
require: true,
rejectUnauthorized: false, // <<<<<<< YOU NEED THIS TO FIX UNHANDLED REJECTION
},
},
},
I instead did this:
production: {
use_env_variable: DATABASE_URL,
dialect: 'postgres',
dialectOptions: {
ssl: {
require: true,
rejectUnauthorized: false, // <<<<<<< YOU NEED THIS TO FIX UNHANDLED REJECTION
},
},
},
Because you are already saying find this as an environment variable with use_env_variable
from cli.
Thanks @zkinsk :)
It's working for me now 👍
from cli.
I found the solution to this stackoverflow question at https://stackoverflow.com/questions/49988002/getting-error-error-parsing-url-undefined-when-trying-to-run-migrations-with-s. In short, the .env
file is not being loaded correctly by sequelize
. To fix this issue, create a file in the root folder called .sequelizerc
. Then, inside this file, add the following code. I changed it back to json
because the original stackoverflow post was using a js
file in the config
folder.
// .sequelizerc
require("dotenv").config(); // <- require this here
// ...Any aditional configuration for sequelize-cli like custom folders for models and migrations
const path = require("path");
module.exports = {
config: path.resolve("config", "config.json"),
"models-path": path.resolve("models"),
"seeders-path": path.resolve("seeders"),
"migrations-path": path.resolve("migrations"),
};
from cli.
I am facing the same issue.
internal/validators.js:120
throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received undefined
at validateString (internal/validators.js:120:11)
at Url.parse (url.js:159:3)
at Object.urlParse [as parse] (url.js:154:13)
at new Sequelize (/mnt/d/work/roughwork/backend/node_modules/sequelize/lib/sequelize.js:185:28)
at Object.<anonymous> (/mnt/d/work/roughwork/backend/src/sequelize.js:11:19)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19) {
code: 'ERR_INVALID_ARG_TYPE'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node src/server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
from cli.
This has worked for me.
use_env_variable: DATABASE_URL,
I don't think you need process.env
as you are already declaring use_env_variable
from cli.
i have no ide, anyone can give other solution?
from cli.
This has worked for me.
use_env_variable: DATABASE_URL,
I don't think you need
process.env
as you are already declaringuse_env_variable
Could you be more specific please?
Where did you use : use_env_variable: DATABASE_URL ?
Thanks
from cli.
This issue has been automatically marked as stale because it has been open for 7 days without activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment or remove the "stale" label. 🙂
from cli.
I am having the same issue
from cli.
Looking into sequelize-cli's source code, use_env_variable
must be the name of the environment variable, as a string. So to fix the above example:
production: {
use_env_variable: 'DATABASE_URL',
dialect: 'postgres',
dialectOptions: {
ssl: {
require: true,
rejectUnauthorized: false, // <<<<<<< YOU NEED THIS TO FIX UNHANDLED REJECTION
},
},
},
from cli.
Related Issues (20)
- Model.associate adding new columns
- Proposal: Controller Generation in Sequelize
- Tests are stuck HOT 5
- postgres: db:create should not fail if the database does exist
- BulkInsert "relation does not exist" in migration script
- const model = require(path.join(__dirname, file)).default( ^ TypeError: require(...).default is not a function
- const model = require(path.join(__dirname, file)).default( ^ TypeError: require(...).default is not a function HOT 1
- Sequelize CLI Fails to Authenticate with Postgres DB Containing a ':' in Password HOT 3
- CLI is not taking default env like node latest versions have (20.8.0)
- SequelizeMeta structure incompatible with SingleStore/memsql HOT 2
- Problem running migrations with yarn
- When on typescript project, sequelize-cli still generates javascript files. HOT 3
- Running migrations, on Azure database HOT 1
- Seeders state in database with using url option
- Migration undo command didn't work correctly. HOT 1
- where condition in literal HOT 1
- nested dependency es5-ext has a security vulnerability (low) and needs update HOT 1
- Subsequent migrations fail after running db:migrate:schema:timestamps:add command
- Please install sqlite3 package manually
- Incompatibility Error with [email protected] and Node.js 21.7.3 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cli.