0

All tests were passing before, but I updated a couple packages and now a bunch of tests are failing because the tests can't find any of the tables in my local/testing database (issue is not just with the users table but with all tables in my db). The package updates happened via Dependabot security fixes, and when the tests were run on the TravisCI server they all passed. Because everything was passing, I already merged the updates into the development branch. Nothing was failing until I pulled the branch and tried to run tests locally.

I can see the database and all the tables it can't find in pgAdmin. I have tried:

  • uninstalling/reinstalling Postgres
  • dropping/recreating the database and re-running migrations in knex to recreate all tables
  • re-installing pg and knex
  • ensuring that the schema is in the search_path as suggested here
  • ensuring that my psql user has schema-level privileges as suggested here

Any other ideas what I could try?

7
  • this is usuially, because you are connected to the wrong database Commented Apr 20, 2022 at 22:53
  • @nbk Do you have suggestions about how I would confirm if there is an issue with the connection? Commented Apr 20, 2022 at 23:20
  • when i run \conninfo at the psql prompt it shows me the expected user and database name, but i don't know how to confirm if that's how my tests are connection. i do see the correct username and database name in the .env variables that are populating my knexfile.js but if there's somewhere else I should check let me know. Commented Apr 20, 2022 at 23:35
  • knexjs has a configuration file, which should contain all information to the connection, see the manual how to start knexjs and postgres has some information functions you can use to determine if the server is correct or the database, when we are at it postgresql.org/docs/9.0/functions-info.html Commented Apr 21, 2022 at 7:57
  • @nbk yes, the config/knex.js pulls its config from knexfile.js, which is populated by variables in .env. everything in those files looks correct and nothing in any of them has changed recently -- this app has been live for several years and this problem just started yesterday so i don't think it's a base configuration issue. any other ideas about why the tests might not be able to find the tables? Commented Apr 22, 2022 at 18:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.