System
- Node.js version: v10.19.0
- NPM version: 6.13.4
- Strapi version: 3.0.0-Beta.2
- Database: PostgreSQL 10.11
- Operating system: MacOS Catalina
Describe the bug
I am trying to run local Strapi on my Mac. npm run build works well. However, it has some problems with 'start' and 'develop'. When I am trying to start it by pm2 start npm --name "CMS" -- start, it keeps restarting. I have checked the app OUT-logs and there is a couple of errors e.g.
{ error: syntax error at or near "url"
at Connection.parseE (/usr/local/var/www/trip4share-cms/node_modules/pg/lib/connection.js:602:11)
at Connection.parseMessage (/usr/local/var/www/trip4share-cms/node_modules/pg/lib/connection.js:399:19)
at Socket.<anonymous> (/usr/local/var/www/trip4share-cms/node_modules/pg/lib/connection.js:121:22)
at Socket.emit (events.js:198:13)
at addChunk (_stream_readable.js:288:12)
at readableAddChunk (_stream_readable.js:269:11)
at Socket.Readable.push (_stream_readable.js:224:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
name: 'error',
length: 92,
severity: 'ERROR',
code: '42601',
detail: undefined,
hint: undefined,
position: '50',
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'scan.l',
line: '1128',
routine: 'scanner_yyerror' }
[2020-04-06T21:30:50.439Z] warn The SQL database indexes haven't been generated successfully. Please enable the debug mode for more details.
{ error: syntax error at or near "name"
at Connection.parseE (/usr/local/var/www/trip4share-cms/node_modules/pg/lib/connection.js:602:11)
at Connection.parseMessage (/usr/local/var/www/trip4share-cms/node_modules/pg/lib/connection.js:399:19)
at Socket.<anonymous> (/usr/local/var/www/trip4share-cms/node_modules/pg/lib/connection.js:121:22)
at Socket.emit (events.js:198:13)
at addChunk (_stream_readable.js:288:12)
at readableAddChunk (_stream_readable.js:269:11)
at Socket.Readable.push (_stream_readable.js:224:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
name: 'error',
length: 93,
severity: 'ERROR',
code: '42601',
detail: undefined,
hint: undefined,
position: '49',
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'scan.l',
line: '1128',
routine: 'scanner_yyerror' }
[2020-04-06T21:30:50.439Z] warn The SQL database indexes haven't been generated successfully. Please enable the debug mode for more details.
When I am running npm run start I am getting the following error.
23 ],
__knexQueryUid: '4301a348-badc-484f-a418-4f0f5ab4a2a6',
sql:
'update "core_store" set "key" = ?, "environment" = ?, "tag" = ?, "value" = ?, "type" = ? where "id" = ?',
returning: undefined }
{ method: 'insert',
options: {},
timeout: false,
cancelOnTimeout: false,
bindings:
[ 'development',
'plugin_upload_provider',
'',
'object',
'{"provider":"local","name":"Local server","enabled":true,"sizeLimit":1000000}' ],
__knexQueryUid: '797edf19-aaab-43ff-a2f3-7c25519fb700',
sql:
'insert into "core_store" ("environment", "key", "tag", "type", "value") values (?, ?, ?, ?, ?) returning "id"',
returning: 'id' }
{ method: 'select',
options: {},
timeout: false,
cancelOnTimeout: false,
bindings: [ 'plugin_users-permissions_advanced', '', '', 1 ],
__knexQueryUid: '51c83527-e289-4c2b-bb0c-48fe7fd34d86',
sql:
'select "core_store".* from "core_store" where "core_store"."key" = ? and "core_store"."environment" = ? and "core_store"."tag" = ? limit ?' }
[2020-04-06T22:20:17.365Z] error error: duplicate key value violates unique constraint "core_store_pkey"
at Connection.parseE (/usr/local/var/www/trip4share-cms/node_modules/pg/lib/connection.js:602:11)
at Connection.parseMessage (/usr/local/var/www/trip4share-cms/node_modules/pg/lib/connection.js:399:19)
at Socket.<anonymous> (/usr/local/var/www/trip4share-cms/node_modules/pg/lib/connection.js:121:22)
at Socket.emit (events.js:198:13)
at addChunk (_stream_readable.js:288:12)
at readableAddChunk (_stream_readable.js:269:11)
at Socket.Readable.push (_stream_readable.js:224:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! trip4share-cms#1.0.0 start: `strapi start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the trip4share-cms#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/Lord-of-the-Mac/.npm/_logs/2020-04-06T22_20_17_400Z-debug.log
The remote version on Linux works well. What should I check?
Related
I am having a little trouble with postgres in docker .. I am running this pipeline in gitlab ... and everything starts fine.. I start a postgres:14-alpine docker image and run unit tests of the application ... and when it's about to start (create the test database) ...
I tried increasing the timeouts
pool: {
max: 50,
min: 5,
idle: 600000, // 10min
acquire: 600000,
createTimeoutMillis: 600000,
acquireTimeoutMillis: 600000,
idleTimeoutMillis: 600000,
reapIntervalMillis: 600000,
createRetryIntervalMillis: 600000
}
but it keeps ending up with this "Connection terminated unexpectedly"
Creating database db_unittests, owner will be postgres.
Executing (default): CREATE DATABASE db_unittests WITH OWNER = postgres;
/builds/project/node_modules/sequelize/lib/dialects/postgres/query.js:386
return new sequelizeErrors.DatabaseError(err);
^
DatabaseError [SequelizeDatabaseError]: Connection terminated unexpectedly
at Query.formatError (/builds/project/node_modules/sequelize/lib/dialects/postgres/query.js:386:16)
at Query.run (/builds/project/node_modules/sequelize/lib/dialects/postgres/query.js:87:18)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async /builds/project/node_modules/sequelize/lib/sequelize.js:619:16
at async run (/builds/project/tests/scripts/database-recreate.js:50:3) {
parent: Error: Connection terminated unexpectedly
at Connection.<anonymous> (/builds/project/node_modules/pg/lib/client.js:132:73)
at Object.onceWrapper (node:events:627:28)
at Connection.emit (node:events:513:28)
at Socket.<anonymous> (/builds/project/node_modules/pg/lib/connection.js:107:12)
at Socket.emit (node:events:525:35)
at endReadableNT (node:internal/streams/readable:1358:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
sql: 'CREATE DATABASE db_unittests WITH OWNER = postgres;',
parameters: undefined
},
original: Error: Connection terminated unexpectedly
at Connection.<anonymous> (/builds/project/node_modules/pg/lib/client.js:132:73)
at Object.onceWrapper (node:events:627:28)
at Connection.emit (node:events:513:28)
at Socket.<anonymous> (/builds/project/node_modules/pg/lib/connection.js:107:12)
at Socket.emit (node:events:525:35)
at endReadableNT (node:internal/streams/readable:1358:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
sql: 'CREATE DATABASE db_unittests WITH OWNER = postgres;',
parameters: undefined
},
sql: 'CREATE DATABASE db_unittests WITH OWNER = postgres;',
parameters: undefined
}
Locally, it all works fine .. only in the pipeline - it acting up :disappointed:
Any idea why is that so? Thanks a lot
I have an app deployed on heroku. My production and dev environments both use PostgreSQL and I use knex for my database querying. I am getting an issue where no resources load onto a page and heroku log --tail says this:
2022-08-23T21:34:19.565970+00:00 app[web.1]: There is an error here: select *, "authors"."name" as "author_name", "authors"."id" as "author_id" from "books" inner join "authors" on "books"."author_id" = "authors"."id" where "books"."id" = $1 limit $2 - column books.author_id does not exist
However, the call works fine on localhost - I have checked my database schema on pgadmin and it appears that the column does exist.
Here is the call to the database:
function getBookById(id) {
console.log(id)
return db('books')
.join('authors', 'books.author_id', 'authors.id')
.where('books.id', id)
.select('*', 'authors.name as author_name', 'authors.id as author_id')
.first()
}
I have done a bit more diving in and looks like it is breaking on a number of database hits and returning 503s.
Here is some more error messages I am getting when I run heroku log --tail
2022-08-24T02:25:36.434109+00:00 app[web.1]: at Parser.parseErrorMessage (/app/node_modules/pg-protocol/dist/parser.js:287:98)
2022-08-24T02:25:36.434109+00:00 app[web.1]: at Parser.handlePacket (/app/node_modules/pg-protocol/dist/parser.js:126:29)
2022-08-24T02:25:36.434110+00:00 app[web.1]: at Parser.parse (/app/node_modules/pg-protocol/dist/parser.js:39:38)
2022-08-24T02:25:36.434110+00:00 app[web.1]: at TLSSocket.<anonymous> (/app/node_modules/pg-protocol/dist/index.js:11:42)
2022-08-24T02:25:36.434111+00:00 app[web.1]: at TLSSocket.emit (node:events:513:28)
2022-08-24T02:25:36.434112+00:00 app[web.1]: at addChunk (node:internal/streams/readable:315:12)
2022-08-24T02:25:36.434112+00:00 app[web.1]: at readableAddChunk (node:internal/streams/readable:289:9)
2022-08-24T02:25:36.434112+00:00 app[web.1]: at TLSSocket.Readable.push (node:internal/streams/readable:228:10)
2022-08-24T02:25:36.434113+00:00 app[web.1]: at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) {
2022-08-24T02:25:36.434113+00:00 app[web.1]: length: 127,
2022-08-24T02:25:36.434114+00:00 app[web.1]: severity: 'ERROR',
2022-08-24T02:25:36.434114+00:00 app[web.1]: code: '42703',
2022-08-24T02:25:36.434114+00:00 app[web.1]: detail: undefined,
2022-08-24T02:25:36.434115+00:00 app[web.1]: hint: undefined,
2022-08-24T02:25:36.434115+00:00 app[web.1]: position: '22',
2022-08-24T02:25:36.434115+00:00 app[web.1]: internalPosition: undefined,
2022-08-24T02:25:36.434115+00:00 app[web.1]: internalQuery: undefined,
2022-08-24T02:25:36.434116+00:00 app[web.1]: where: undefined,
2022-08-24T02:25:36.434116+00:00 app[web.1]: schema: undefined,
2022-08-24T02:25:36.434116+00:00 app[web.1]: table: undefined,
2022-08-24T02:25:36.434116+00:00 app[web.1]: column: undefined,
2022-08-24T02:25:36.434117+00:00 app[web.1]: dataType: undefined,
2022-08-24T02:25:36.434117+00:00 app[web.1]: constraint: undefined,
2022-08-24T02:25:36.434117+00:00 app[web.1]: file: 'parse_target.c',
2022-08-24T02:25:36.434118+00:00 app[web.1]: line: '1061',
2022-08-24T02:25:36.434118+00:00 app[web.1]: routine: 'checkInsertTargets'
2022-08-24T02:25:36.434118+00:00 app[web.1]: }
2022-08-24T02:25:36.434240+00:00 app[web.1]: There is an error here: insert into "books" ("author_id", "blurb", "cover_image", "genre", "pub_year", "title") values ($1, $2, $3, $4, $5, $6) returning "id" - column "author_id" of relation "books" does not exist
I'm not sure if this is something weird with heroku's postgres - or something I'm doing wrong (more likely). It is unclear to me how to further trouble shoot this issue.
Thanks for an help
I'am a newbie frontend trainee, and I have a task to configure my project on node-typescript-koa-rest. I tried to do my best to configure it, but it has an error.
First of all, I get this project, https://github.com/javieraviles/node-typescript-koa-rest, add here objection.js, knex.js, installed postgresql. After starting my project, I recieve an "TypeORM connection error: error: password authentication failed for user "user" ". From error message I can't get where username for db sets.
On start script.ts is running.
https://pastebin.com/fm0TBaXQ
Where I can change username and password?
Full error message:
TypeORM connection error: error: password authentication failed for user "user"
at Connection.parseE (/home/valentin/Projects/app/node_modules/pg/lib/connection.js:553:11)
at Connection.parseMessage (/home/valentin/Projects/app/node_modules/pg/lib/connection.js:378:19)
at TLSSocket.<anonymous> (/home/valentin/Projects/app/node_modules/pg/lib/connection.js:119:22)
at TLSSocket.emit (events.js:203:13)
at TLSSocket.EventEmitter.emit (domain.js:476:20)
at addChunk (_stream_readable.js:295:12)
at readableAddChunk (_stream_readable.js:276:11)
at TLSSocket.Readable.push (_stream_readable.js:210:10)
at TLSWrap.onStreamRead (internal/stream_base_commons.js:166:17) {
name: 'error',
length: 100,
severity: 'FATAL',
code: '28P01',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'auth.c',
line: '328',
routine: 'auth_failed'
}
Check the databaseUrl setting in the config.ts file.
I have mongoose throwing this error from time to time, it's not stopping the node application from running but I can't find any information about whats causing the error and I would like to fix it.
The link to the repo is here https://github.com/bkawk/divergence2
I have found I can stop the error by adding a limit to the records here
https://github.com/bkawk/divergence2/blob/master/src/db.js#L94
{ MongoError: cursor id 31871209567 not found
at /Users/bkawk/Documents/divergence2/node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js:598:61
at authenticateStragglers (/Users/bkawk/Documents/divergence2/node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js:516:16)
at Connection.messageHandler (/Users/bkawk/Documents/divergence2/node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js:552:5)
at emitMessageHandler (/Users/bkawk/Documents/divergence2/node_modules/mongoose/node_modules/mongodb-core/lib/connection/connection.js:309:10)
at Socket.<anonymous> (/Users/bkawk/Documents/divergence2/node_modules/mongoose/node_modules/mongodb-core/lib/connection/connection.js:488:15)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at Socket.Readable.push (_stream_readable.js:208:10)
at TCP.onread (net.js:607:20)
name: 'MongoError',
message: 'cursor id 31871209567 not found',
ok: 0,
errmsg: 'cursor id 31871209567 not found',
code: 43,
codeName: 'CursorNotFound' }
I have a Job model that searches a table of jobs. The table was created using rails, and I set 'migrate' to 'safe' in the Job model. I have written out all the attributes in the model. I cannot get basic functions to work in the sails console. I have three jobs in the table, with ids 1,2, and 3. When I execute:
sails> Job.findOneById(1).done(function(err,job){console.log(j.id)})
It poops out on me. The sails console crashes (super annoying). The output looks like this:
sails> Job.findOneById(1).done(function(err,job){console.log(j.id)})
undefined
sails>
/home/redmage/tac/node_modules/sails-postgresql/lib/query.js:544
var type = self._schema[key].type;
^
TypeError: Cannot read property 'type' of undefined
at /home/redmage/tac/node_modules/sails-postgresql/lib/query.js:544:33
at Array.forEach (native)
at Query.cast (/home/redmage/tac/node_modules/sails-postgresql/lib/query.js:541:23)
at /home/redmage/tac/node_modules/sails-postgresql/lib/adapter.js:372:32
at Array.forEach (native)
at __FIND__ (/home/redmage/tac/node_modules/sails-postgresql/lib/adapter.js:371:23)
at Query.handleReadyForQuery (/home/redmage/tac/node_modules/sails-postgresql/node_modules/pg/lib/query.js:84:10)
at null.<anonymous> (/home/redmage/tac/node_modules/sails-postgresql/node_modules/pg/lib/client.js:159:19)
at EventEmitter.emit (events.js:117:20)
at null.<anonymous> (/home/redmage/tac/node_modules/sails-postgresql/node_modules/pg/lib/connection.js:97:12)
at Socket.EventEmitter.emit (events.js:95:17)
at Socket.<anonymous> (_stream_readable.js:746:14)
at Socket.EventEmitter.emit (events.js:92:17)
at emitReadable_ (_stream_readable.js:408:10)
at emitReadable (_stream_readable.js:404:5)
at readableAddChunk (_stream_readable.js:165:9)
at Socket.Readable.push (_stream_readable.js:127:10)
at TCP.onread (net.js:528:21)
Here is the ORM for Job. It is very basic:
module.exports = {
//VERY IMPORTANT:
migrate: 'safe',
tableName: 'jobs',
attributes: {
}
}