Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

database error after upgrade to v3.2.0 or v3.2.1 #8227

Closed
bglidwell opened this issue Oct 7, 2020 · 2 comments · Fixed by #8232
Closed

database error after upgrade to v3.2.0 or v3.2.1 #8227

bglidwell opened this issue Oct 7, 2020 · 2 comments · Fixed by #8232
Labels
issue: bug Issue reporting a bug severity: high If it breaks the basic use of the product source: core:database Source is core/database package status: confirmed Confirmed by a Strapi Team member or multiple community members

Comments

@bglidwell
Copy link
Contributor

Describe the bug
Getting "null value in column "id" violates not-null constraint after upgrade from 3.1.7 to v3.2.0 and v3.2.1

knex debug shows:

2020-10-07T14:15:16.600105+00:00 app[web.1]: '{"uid":"strapi::core-store","collectionName":"core_store","info":{"name":"core_store","description":""},"options":{"timestamps":false},"attributes":{"key":{"type":"string"},"value":{"type":"text"},"type":{"type":"string"},"environment":{"type":"string"},"tag":{"type":"string"}}}'
2020-10-07T14:15:16.600105+00:00 app[web.1]: ],
2020-10-07T14:15:16.600106+00:00 app[web.1]: __knexQueryUid: '24d4d9ef-15e0-44af-a5cd-116faea1acea',
2020-10-07T14:15:16.600106+00:00 app[web.1]: sql: 'insert into "core_store" ("id", "key", "type", "value") values (?, ?, ?, ?) returning *',
2020-10-07T14:15:16.600107+00:00 app[web.1]: returning: '*'
2020-10-07T14:15:16.600107+00:00 app[web.1]: }
2020-10-07T14:15:16.630667+00:00 app[web.1]: [2020-10-07T14:15:16.630Z] debug ⛔️ Server wasn't able to start properly.
2020-10-07T14:15:16.640014+00:00 app[web.1]: [2020-10-07T14:15:16.639Z] error error: null value in column 
"id" violates not-null constraint
2020-10-07T14:15:16.640015+00:00 app[web.1]: at Parser.parseErrorMessage (/app/node_modules/pg-protocol/dist/parser.js:278:15)
2020-10-07T14:15:16.640015+00:00 app[web.1]: at Parser.handlePacket (/app/node_modules/pg-protocol/dist/parser.js:126:29)
2020-10-07T14:15:16.640016+00:00 app[web.1]: at Parser.parse (/app/node_modules/pg-protocol/dist/parser.js:39:38)
2020-10-07T14:15:16.640017+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/pg-protocol/dist/index.js:10:42)
2020-10-07T14:15:16.640017+00:00 app[web.1]: at Socket.emit (events.js:314:20)
2020-10-07T14:15:16.640018+00:00 app[web.1]: at addChunk (_stream_readable.js:307:12)
2020-10-07T14:15:16.640019+00:00 app[web.1]: at readableAddChunk (_stream_readable.js:282:9)
2020-10-07T14:15:16.640019+00:00 app[web.1]: at Socket.Readable.push (_stream_readable.js:221:10)
2020-10-07T14:15:16.640019+00:00 app[web.1]: at TCP.onStreamRead (internal/stream_base_commons.js:188:23) 
2020-10-07T14:15:16.640020+00:00 app[web.1]: at TCP.callbackTrampoline (internal/async_hooks.js:129:14)   
2020-10-07T14:15:16.674294+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-10-07T14:15:16.674839+00:00 app[web.1]: npm ERR! errno 1

Steps to reproduce the behavior

  1. Upgrade strapi to v3.2.0
  2. Deploy to heroku
  3. heroku logs --tail

Expected behavior
server starts successfully

System

  • Node.js version: 14.13.0
  • NPM version: 6.14.8
  • Strapi version: 3.2.0
  • Database: Heroku Postgres
  • Operating system: Heroku dyno

Additional context
server seems to start okay on my local dev using sqlite3

@derrickmehaffy
Copy link
Member

I can confirm this using the following test project: https://github.com/derrickmehaffy/Strapi-Heroku-Test

Same error as above:

2020-10-07T14:31:13.989314+00:00 app[web.1]: > dm-strapi-test@0.1.0 start /app
2020-10-07T14:31:13.989315+00:00 app[web.1]: > strapi start
2020-10-07T14:31:13.989315+00:00 app[web.1]: 
2020-10-07T14:31:16.184678+00:00 app[web.1]: [2020-10-07T14:31:16.183Z] debug ⛔️ Server wasn't able to start properly.
2020-10-07T14:31:16.185899+00:00 app[web.1]: [2020-10-07T14:31:16.185Z] error error: null value in column "id" violates not-null constraint
2020-10-07T14:31:16.185900+00:00 app[web.1]: at Parser.parseErrorMessage (/app/node_modules/pg-protocol/dist/parser.js:278:15)
2020-10-07T14:31:16.185900+00:00 app[web.1]: at Parser.handlePacket (/app/node_modules/pg-protocol/dist/parser.js:126:29)
2020-10-07T14:31:16.185901+00:00 app[web.1]: at Parser.parse (/app/node_modules/pg-protocol/dist/parser.js:39:38)
2020-10-07T14:31:16.185901+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/pg-protocol/dist/index.js:8:42)
2020-10-07T14:31:16.185902+00:00 app[web.1]: at Socket.emit (events.js:314:20)
2020-10-07T14:31:16.185902+00:00 app[web.1]: at addChunk (_stream_readable.js:298:12)
2020-10-07T14:31:16.185903+00:00 app[web.1]: at readableAddChunk (_stream_readable.js:273:9)
2020-10-07T14:31:16.185904+00:00 app[web.1]: at Socket.Readable.push (_stream_readable.js:214:10)
2020-10-07T14:31:16.185904+00:00 app[web.1]: at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
2020-10-07T14:31:16.205254+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-10-07T14:31:16.205617+00:00 app[web.1]: npm ERR! errno 1
2020-10-07T14:31:16.215228+00:00 app[web.1]: npm ERR! dm-strapi-test@0.1.0 start: `strapi start`
2020-10-07T14:31:16.215406+00:00 app[web.1]: npm ERR! Exit status 1
2020-10-07T14:31:16.215599+00:00 app[web.1]: npm ERR!
2020-10-07T14:31:16.215762+00:00 app[web.1]: npm ERR! Failed at the dm-strapi-test@0.1.0 start script.
2020-10-07T14:31:16.215929+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-10-07T14:31:16.224955+00:00 app[web.1]: 
2020-10-07T14:31:16.225109+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-10-07T14:31:16.225208+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2020-10-07T14_31_16_217Z-debug.log
2020-10-07T14:31:16.286189+00:00 heroku[web.1]: Process exited with status 1
2020-10-07T14:31:16.329740+00:00 heroku[web.1]: State changed from starting to crashed
2020-10-07T14:31:51.637928+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/admin" host=dm-strapi-test.herokuapp.com request_id=cd93ce06-f5e2-434d-9114-5225b0be5465 fwd="174.73.250.60" dyno= connect= service= status=503 bytes= protocol=https

Enabling Knex debugging yields a strange request with no bindings, something is trying to write into the core_store and is setting all columns as null.

@derrickmehaffy derrickmehaffy added severity: high If it breaks the basic use of the product source: core:database Source is core/database package status: confirmed Confirmed by a Strapi Team member or multiple community members issue: bug Issue reporting a bug labels Oct 7, 2020
@derrickmehaffy
Copy link
Member

Test with v3.2.0 and v3.2.1 same problem, if I revert to v3.1.x it works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: bug Issue reporting a bug severity: high If it breaks the basic use of the product source: core:database Source is core/database package status: confirmed Confirmed by a Strapi Team member or multiple community members
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants