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

Can't access projects since upgrade to 0.90.0 #1722

Closed
jopellerin opened this issue Apr 16, 2022 · 26 comments
Closed

Can't access projects since upgrade to 0.90.0 #1722

jopellerin opened this issue Apr 16, 2022 · 26 comments
Assignees
Labels
🔴 Priority : Critical Issue prevents most users from using NocoDB or the core functionality is breaking 🐛 Type: Bug Something is broken or incorrect unexpectedly.

Comments

@jopellerin
Copy link

Hi,

I just tried upgrading NocoDB from 0.84.16 to 0.90.0 using docker-compose pull, and I'm experiencing some issues. When I loaded NocoDB in my browser the first time after the upgrade, I got presented with the Sign Up page, but I mindlessly entered my login info (that was already in the database) and clicked "Sign Up", not realizing it was not the login page. At that point, I got redirected to my project list, like if I had just logged in. The problem is that now every project I try to open fails to load with the message: "Error: Request failed with status code 403". Did I just break something in my account info?

I'm guessing this might be a problem with the data in the database, don't hesitate to ask for contents of tables if needed.

Thanks for the awesome work on NocoDB, I'm really enjoying it!

Steps To Reproduce

  1. Upgrade from version 0.84.16 using docker-compose pull && docker-compose up --build -d
  2. Go to NocoDB URL
  3. Fill the sign up form with information already found in the database and submit form
  4. Try to load any project
  5. See error about HTTP 403

Expected behavior
Be able to load projects

NocoDB used as docker : true
NocoDB version : 0.90.0
Database used in NC_DB URL : mysql
Project was created by clicking : New Project by connecting to external database
Database on which spreadsheet is created : mysql
OS on which NocoDB is running : Docker on Ubuntu Server 20.04.4 LTS
Database version : MariaDB 10.7.3

@jopellerin jopellerin changed the title Can't access projects since upgrade to 0.9.0 Can't access projects since upgrade to 0.90.0 Apr 16, 2022
@wingkwong
Copy link
Member

Any logs you can provide?

@pranavxc
Copy link
Member

Can you share the docker-compose.yml file that you are using?

@FerLSanchez
Copy link

FerLSanchez commented Apr 17, 2022

Happens the same to me, also with Docker... but I realized and tried to login, without success.
The only error I see in the logs is:

Error Error: insert into `nc_audit_v2` (`base_id`, `created_at`, `description`, `details`, `fk_model_id`, `id`, `ip`, `op_sub_type`, `op_type`, `project_id`, `row_id`, `status`, `updated_at`, `user`) values (DEFAULT, '2021-12-14 17:28:56', 'created project Bodega(bodega_vpog) within xcdb ', NULL, DEFAULT, 'adt_8r4u7fbta5y36e', '192.168.1.1', 'CREATED', 'PROJECT', 'bodega_vpog', NULL, NULL, '2021-12-14 17:28:56', '*@test.com') - Cannot add or update a child row: a foreign key constraint fails (`noco`.`nc_audit_v2`, CONSTRAINT `nc_audit_v2_project_id_foreign` FOREIGN KEY (`project_id`) REFERENCES `nc_projects_v2` (`id`))

@FerLSanchez
Copy link

FerLSanchez commented Apr 17, 2022

My compose is this one:

nocodb:
  links:
    - 'dbmysql:dbmysql'
  image: 'nocodb/nocodb:latest'
  ports:
    - '9291:8080'
  volumes:
    - '/data/noco_data:/usr/app/data'
  restart: unless-stopped
  networks:
    - service_network
  environment:
    NC_DB: 'mysql2://dbmysql:3306?u=mydbuser&p=mydbpassword&d=noco'
    NC_INVITE_ONLY_SIGNUP: 'true'
    NC_DISABLE_TELE: 'true'
    NC_PUBLIC_URL: 'https://noco.myprivatedomain.com'
    DB_QUERY_LIMIT_MAX: '10000'
  mem_limit: 512MB

The databases are all there, even the register of my login in xc_users

@FerLSanchez
Copy link

First review to _v2 tables in primary noco db... created by empty, all of them, it seems. Even nc_users_v2, that I assume is the one replacing xc_users for authentication purposes :/

@pranavxc
Copy link
Member

Happens the same to me, also with Docker... but I realized and tried to login, without success. The only error I see in the logs is:

Error Error: insert into `nc_audit_v2` (`base_id`, `created_at`, `description`, `details`, `fk_model_id`, `id`, `ip`, `op_sub_type`, `op_type`, `project_id`, `row_id`, `status`, `updated_at`, `user`) values (DEFAULT, '2021-12-14 17:28:56', 'created project Bodega(bodega_vpog) within xcdb ', NULL, DEFAULT, 'adt_8r4u7fbta5y36e', '192.168.1.1', 'CREATED', 'PROJECT', 'bodega_vpog', NULL, NULL, '2021-12-14 17:28:56', 'hola@fersanchez.com') - Cannot add or update a child row: a foreign key constraint fails (`noco`.`nc_audit_v2`, CONSTRAINT `nc_audit_v2_project_id_foreign` FOREIGN KEY (`project_id`) REFERENCES `nc_projects_v2` (`id`))

Thanks for sharing the log and it's really helpful. It's trying to migrate the audit log of a deleted project that's causing the problem, so we will immediately fix it and do a bug fix release.

@FerLSanchez
Copy link

No prob, happy to help, guys. Awesome project, here to help on whatever I can! Thank you!

@wingkwong wingkwong added 🐛 Type: Bug Something is broken or incorrect unexpectedly. 🔴 Priority : Critical Issue prevents most users from using NocoDB or the core functionality is breaking labels Apr 17, 2022
@eitchtee
Copy link

Same problem here

Error after the update:

Error error: insert into "nc_audit_v2" ("base_id", "created_at", "description", "details", "fk_model_id", "id", "ip", "op_sub_type", "op_type", "project_id", "row_id", "status", "updated_at", "user") values (DEFAULT, $1, $2, $3, DEFAULT, $4, $5, $6, $7, $8, $9, $10, $11, $12) - insert or update on table "nc_audit_v2" violates foreign key constraint "nc_audit_v2_project_id_foreign"

Error when accessing a project:

GET /api/v1/db/auth/user/me?project_id=cerberus_blsm 304 - - 1.458 ms
 s [Error]: projectGet - user : Not allowed
    at Function.forbidden (/usr/src/app/docker/main.js:2:36294)
    at /usr/src/app/docker/main.js:2:14137
    at /usr/src/app/docker/main.js:2:35562
    at Layer.handle [as handle_request] (/usr/src/app/node_modules/express/lib/router/layer.js:95:5)
    at next (/usr/src/app/node_modules/express/lib/router/route.js:137:13)
    at /usr/src/app/docker/main.js:2:13845
    at /usr/src/app/docker/main.js:2:35562
    at Layer.handle [as handle_request] (/usr/src/app/node_modules/express/lib/router/layer.js:95:5)
    at next (/usr/src/app/node_modules/express/lib/router/route.js:137:13)
    at t.default (/usr/src/app/docker/main.js:2:487981)

@pranavxc pranavxc self-assigned this Apr 17, 2022
pranavxc added a commit that referenced this issue Apr 17, 2022
re #1722

Signed-off-by: Pranav C <pranavxc@gmail.com>
@pranavxc
Copy link
Member

Same problem here

Error after the update:

Error error: insert into "nc_audit_v2" ("base_id", "created_at", "description", "details", "fk_model_id", "id", "ip", "op_sub_type", "op_type", "project_id", "row_id", "status", "updated_at", "user") values (DEFAULT, $1, $2, $3, DEFAULT, $4, $5, $6, $7, $8, $9, $10, $11, $12) - insert or update on table "nc_audit_v2" violates foreign key constraint "nc_audit_v2_project_id_foreign"

Error when accessing a project:

GET /api/v1/db/auth/user/me?project_id=cerberus_blsm 304 - - 1.458 ms
 s [Error]: projectGet - user : Not allowed
    at Function.forbidden (/usr/src/app/docker/main.js:2:36294)
    at /usr/src/app/docker/main.js:2:14137
    at /usr/src/app/docker/main.js:2:35562
    at Layer.handle [as handle_request] (/usr/src/app/node_modules/express/lib/router/layer.js:95:5)
    at next (/usr/src/app/node_modules/express/lib/router/route.js:137:13)
    at /usr/src/app/docker/main.js:2:13845
    at /usr/src/app/docker/main.js:2:35562
    at Layer.handle [as handle_request] (/usr/src/app/node_modules/express/lib/router/layer.js:95:5)
    at next (/usr/src/app/node_modules/express/lib/router/route.js:137:13)
    at t.default (/usr/src/app/docker/main.js:2:487981)

Could you be able to see the project list?

@eitchtee
Copy link

eitchtee commented Apr 17, 2022

Could you be able to see the project list?

@pranavxc Yes, login and project list is working

image

When I click on a project I get an error 403
image

I'm using a superadmin account if that's helpful, no other accounts, only API Tokens

pranavxc added a commit that referenced this issue Apr 17, 2022
re #1722

Signed-off-by: Pranav C <pranavxc@gmail.com>
@pranavxc
Copy link
Member

pranavxc commented Apr 17, 2022

Could you be able to see the project list?

@pranavxc Yes, login and project list is working

image

When I click on a project I get an error 403 image

I'm using a superadmin account if that's helpful, no other accounts, only API Tokens

Few more queries that will be helpful to resolve the issue:

  • Are you using it through docker or as a node project?
  • Which database are you using as meta DB?
  • How did you migrate to the latest version(steps/docs)?

@FerLSanchez
Copy link

BTW, is it safe to rollback to 0.84.16?
Thanks!

@eitchtee
Copy link

eitchtee commented Apr 17, 2022

Few more queries that will be helpful to resolve the issue:

  • Are you using it through docker or as a node project?
  • Which database are you using as meta DB?
  • How did you migrate to the latest version(steps/docs)?

@pranavxc

  1. Docker
  2. Postgres
  3. Update happened automatically through Watchtower as per the logs bellow. No other step was taken.
time="2022-04-17T04:01:06-03:00" level=info msg="Found new nocodb/nocodb:latest image (ecc90ccf6948)"
time="2022-04-17T04:01:21-03:00" level=info msg="Stopping /nocodb (9244003bb149) with SIGTERM"
time="2022-04-17T04:01:37-03:00" level=info msg="Creating /nocodb"
time="2022-04-17T04:01:38-03:00" level=info msg="Removing image d2133f3cbc4f"
time="2022-04-17T04:01:38-03:00" level=info msg="Removing image 3f118229351b"
time="2022-04-17T04:01:40-03:00" level=info msg="Session done" Failed=0 Scanned=18 Updated=2 notify=no

@pranavxc
Copy link
Member

BTW, is it safe to rollback to 0.84.16? Thanks!

yes, you can roll back to 0.84.16 until we fix this issue. It will work without any issue.

@pranavxc
Copy link
Member

Few more queries that will be helpful to resolve the issue:

  • Are you using it through docker or as a node project?
  • Which database are you using as meta DB?
  • How did you migrate to the latest version(steps/docs)?
  1. Docker
  2. Postgres
  3. Update happened automatically through Watchtower as per the logs bellow. No other step was taken.
time="2022-04-17T04:01:06-03:00" level=info msg="Found new nocodb/nocodb:latest image (ecc90ccf6948)"
time="2022-04-17T04:01:21-03:00" level=info msg="Stopping /nocodb (9244003bb149) with SIGTERM"
time="2022-04-17T04:01:37-03:00" level=info msg="Creating /nocodb"
time="2022-04-17T04:01:38-03:00" level=info msg="Removing image d2133f3cbc4f"
time="2022-04-17T04:01:38-03:00" level=info msg="Removing image 3f118229351b"
time="2022-04-17T04:01:40-03:00" level=info msg="Session done" Failed=0 Scanned=18 Updated=2 notify=no

Thanks for sharing.

@eitchtee
Copy link

Also, here is the full startup log until the error mentioned above happened

App started successfully.
Visit -> http://localhost:8080/dashboard
Creating REST APIs pg - > nocodb_db
Creating REST APIs pg - > nocodb_db
Creating REST APIs pg - > nocodb_db
Creating REST APIs pg - > nocodb_db
Error error: insert into "nc_audit_v2" ("base_id", "created_at", "description", "details", "fk_model_id", "id", "ip", "op_sub_type", "op_type", "project_id", "row_id", "status", "updated_at", "user") values (DEFAULT, $1, $2, $3, DEFAULT, $4, $5, $6, $7, $8, $9, $10, $11, $12) - insert or update on table "nc_audit_v2" violates foreign key constraint "nc_audit_v2_project_id_foreign"
    at Parser.parseErrorMessage (/usr/src/app/node_modules/pg-protocol/dist/parser.js:287:98)
    at Parser.handlePacket (/usr/src/app/node_modules/pg-protocol/dist/parser.js:126:29)
    at Parser.parse (/usr/src/app/node_modules/pg-protocol/dist/parser.js:39:38)
    at Socket.<anonymous> (/usr/src/app/node_modules/pg-protocol/dist/index.js:11:42)
    at Socket.emit (events.js:314:20)
    at Socket.EventEmitter.emit (domain.js:483:12)
    at addChunk (_stream_readable.js:297:12)
    at readableAddChunk (_stream_readable.js:272:9)
    at Socket.Readable.push (_stream_readable.js:213:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:188:23) {
  length: 299,
  severity: 'ERROR',
  code: '23503',
  detail: 'Key (project_id)=(teste_blqm) is not present in table "nc_projects_v2".',
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: 'public',
  table: 'nc_audit_v2',
  column: undefined,
  dataType: undefined,
  constraint: 'nc_audit_v2_project_id_foreign',
  file: 'ri_triggers.c',
  line: '2528',
  routine: 'ri_ReportViolation'
}

@o1lab
Copy link
Member

o1lab commented Apr 17, 2022

Thank you @eitchtee @FerLSanchez @jopellerin for reporting this on sunday.

We've a fix - could you please ping me or @pranavxc in our discord : https://discord.gg/5RgZmkW

@o1lab
Copy link
Member

o1lab commented Apr 17, 2022

Thank you @FerLSanchez for confirming below image works.

nocodb/nocodb-timely:20220417-0813

We will make a release soon.

@o1lab
Copy link
Member

o1lab commented Apr 17, 2022

Solution in 0.90.1

@FerLSanchez
Copy link

Updated and it seems to be working. Just a silly thing: you forgot to update tooltip for the logo and it still says 0.90.0 ;)
Thank you!

@o1lab
Copy link
Member

o1lab commented Apr 17, 2022

If you do a hard refresh - you should see it 0.90.1 :)

@wingkwong
Copy link
Member

@FerLSanchez

image

@FerLSanchez
Copy link

Hahaha, you're great, guys. Nice work solving this issue! Thank you!

@eitchtee
Copy link

eitchtee commented Apr 17, 2022

After updating to 0.90.1 I'm getting a new error related to the database:

Error error: insert into "nc_audit_v2" ("base_id", "created_at", "description", "details", "fk_model_id", "id", "ip", "op_sub_type", "op_type", "project_id", "row_id", "status", "updated_at", "user") values (DEFAULT, $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13) - insert or update on table "nc_audit_v2" violates foreign key constraint "nc_audit_v2_fk_model_id_foreign"
    at Parser.parseErrorMessage (/usr/src/app/node_modules/pg-protocol/dist/parser.js:287:98)
    at Parser.handlePacket (/usr/src/app/node_modules/pg-protocol/dist/parser.js:126:29)
    at Parser.parse (/usr/src/app/node_modules/pg-protocol/dist/parser.js:39:38)
    at Socket.<anonymous> (/usr/src/app/node_modules/pg-protocol/dist/index.js:11:42)
    at Socket.emit (events.js:314:20)
    at Socket.EventEmitter.emit (domain.js:483:12)
    at addChunk (_stream_readable.js:297:12)
    at readableAddChunk (_stream_readable.js:272:9)
    at Socket.Readable.push (_stream_readable.js:213:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:188:23) {
  length: 292,
  severity: 'ERROR',
  code: '23503',
  detail: 'Key (fk_model_id)=(10) is not present in table "nc_models_v2".',
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: 'public',
  table: 'nc_audit_v2',
  column: undefined,
  dataType: undefined,
  constraint: 'nc_audit_v2_fk_model_id_foreign',
  file: 'ri_triggers.c',
  line: '2528',
  routine: 'ri_ReportViolation'
}

Also, projectGet - user : Not allowed problem persists, giving me a 403 when opening any project

GET /api/v1/db/auth/user/me?project_id=hermes_b_pm 200 175 - 5.140 ms
 s [Error]: projectGet - user : Not allowed
    at Function.forbidden (/usr/src/app/docker/main.js:2:36294)
    at /usr/src/app/docker/main.js:2:14137
    at /usr/src/app/docker/main.js:2:35562
    at Layer.handle [as handle_request] (/usr/src/app/node_modules/express/lib/router/layer.js:95:5)
    at next (/usr/src/app/node_modules/express/lib/router/route.js:137:13)
    at /usr/src/app/docker/main.js:2:13845
    at /usr/src/app/docker/main.js:2:35562
    at Layer.handle [as handle_request] (/usr/src/app/node_modules/express/lib/router/layer.js:95:5)
    at next (/usr/src/app/node_modules/express/lib/router/route.js:137:13)
    at t.default (/usr/src/app/docker/main.js:2:488057)

Downgrading to 0.84.16 worked for now.

@eitchtee
Copy link

After updating to 0.90.1 I'm getting a new error related to the database:

Error error: insert into "nc_audit_v2" ("base_id", "created_at", "description", "details", "fk_model_id", "id", "ip", "op_sub_type", "op_type", "project_id", "row_id", "status", "updated_at", "user") values (DEFAULT, $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13) - insert or update on table "nc_audit_v2" violates foreign key constraint "nc_audit_v2_fk_model_id_foreign"
    at Parser.parseErrorMessage (/usr/src/app/node_modules/pg-protocol/dist/parser.js:287:98)
    at Parser.handlePacket (/usr/src/app/node_modules/pg-protocol/dist/parser.js:126:29)
    at Parser.parse (/usr/src/app/node_modules/pg-protocol/dist/parser.js:39:38)
    at Socket.<anonymous> (/usr/src/app/node_modules/pg-protocol/dist/index.js:11:42)
    at Socket.emit (events.js:314:20)
    at Socket.EventEmitter.emit (domain.js:483:12)
    at addChunk (_stream_readable.js:297:12)
    at readableAddChunk (_stream_readable.js:272:9)
    at Socket.Readable.push (_stream_readable.js:213:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:188:23) {
  length: 292,
  severity: 'ERROR',
  code: '23503',
  detail: 'Key (fk_model_id)=(10) is not present in table "nc_models_v2".',
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: 'public',
  table: 'nc_audit_v2',
  column: undefined,
  dataType: undefined,
  constraint: 'nc_audit_v2_fk_model_id_foreign',
  file: 'ri_triggers.c',
  line: '2528',
  routine: 'ri_ReportViolation'
}

Also, projectGet - user : Not allowed problem persists, giving me a 403 when opening any project

GET /api/v1/db/auth/user/me?project_id=hermes_b_pm 200 175 - 5.140 ms
 s [Error]: projectGet - user : Not allowed
    at Function.forbidden (/usr/src/app/docker/main.js:2:36294)
    at /usr/src/app/docker/main.js:2:14137
    at /usr/src/app/docker/main.js:2:35562
    at Layer.handle [as handle_request] (/usr/src/app/node_modules/express/lib/router/layer.js:95:5)
    at next (/usr/src/app/node_modules/express/lib/router/route.js:137:13)
    at /usr/src/app/docker/main.js:2:13845
    at /usr/src/app/docker/main.js:2:35562
    at Layer.handle [as handle_request] (/usr/src/app/node_modules/express/lib/router/layer.js:95:5)
    at next (/usr/src/app/node_modules/express/lib/router/route.js:137:13)
    at t.default (/usr/src/app/docker/main.js:2:488057)

Downgrading to 0.84.16 worked for now.

Worth noting that upgrading to 0.90.1 from a db backup before any migration done by 0.90 also results in the same error

pranavxc added a commit that referenced this issue Apr 17, 2022
…if missing meta

re #1722

Signed-off-by: Pranav C <pranavxc@gmail.com>
pranavxc added a commit that referenced this issue Apr 17, 2022
…if missing meta (#1732)

re #1722

Signed-off-by: Pranav C <pranavxc@gmail.com>
pranavxc added a commit that referenced this issue Apr 17, 2022
* fix: unsafe repository issue in actions/checkout

Signed-off-by: Wing-Kam Wong <wingkwong.code@gmail.com>

* fix: remove extra space

Signed-off-by: Wing-Kam Wong <wingkwong.code@gmail.com>

* docs: fix delete function name

Signed-off-by: Wing-Kam Wong <wingkwong.code@gmail.com>

* fix: remove duplicate and add missing delete api (#1731)

Signed-off-by: mertmit <mertmit99@gmail.com>

* fix: extract correct model id on audit export and ignore table audit if missing meta (#1732)

re #1722

Signed-off-by: Pranav C <pranavxc@gmail.com>

Co-authored-by: Wing-Kam Wong <wingkwong.code@gmail.com>
Co-authored-by: mertmit <mertmit99@gmail.com>
@github-actions
Copy link
Contributor

Fixed in v0.90.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔴 Priority : Critical Issue prevents most users from using NocoDB or the core functionality is breaking 🐛 Type: Bug Something is broken or incorrect unexpectedly.
Projects
None yet
Development

No branches or pull requests

6 participants