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

called with an Error: { AdapterError: Unexpected error from database adapter: relation "public.block" does not exist #19

Open
mingjiahui opened this issue Mar 19, 2021 · 12 comments

Comments

@mingjiahui
Copy link

mingjiahui commented Mar 19, 2021

Hi, I encountered the following error, could you please tell me how to solve it? Thank you in advance.
I changed the appconfig.json like this:
{ "email": { "admin":"admin_email@gmail.com", "auth": { "user": "admin_email@gmail.com", "pass": "password" }, "service": "Gmail", "emailVerification": 1 }, "database": { "adapter": "sails-postgresql", "user": "airmed", "password": "LYbAWCErGttRsP9y", "port": "5432", "host": "localhost", "database": "airmed" }, "session": { "name": "sails.sid", "secret": "secretKey", "redis": { "url": "redis://: redisPassword@127.0.0.1.com:6379/15", "host": "127.0.0.1", "port": 6379, "pass": "redisPassword", "db": 15 } }, "ipfs": { "host":"127.0.0.1", "port":"5001" } }

database:{... "user": "airmed", "password": "LYbAWCErGttRsP9y" ...} is this right?

Everything else is normal.

Custom response `res.serverError()` called with an Error: { AdapterError: Unexpected error from database adapter: relation "public.block" does not exist
    at Object.fn (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/api/controllers/block/gettotal.js:15:31)
    at wrapper (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/@sailshq/lodash/lib/index.js:3275:19)
    at Deferred._handleExec (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/machine/lib/private/help-build-machine.js:1016:29)
    at Deferred.exec (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/parley/lib/private/Deferred.js:286:10)
    at Deferred.switch (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/machine/lib/private/help-build-machine.js:1469:16)
    at Object._requestHandler [as block/gettotal] (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/machine-as-action/lib/machine-as-action.js:1153:27)
    at /home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/sails/lib/router/bind.js:248:46
    at routeTargetFnWrapper (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/sails/lib/router/bind.js:392:9)
    at Layer.handle [as handle_request] (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/layer.js:95:5)
    at /home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/index.js:281:22
    at Function.process_params (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/index.js:335:12)
    at next (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/index.js:275:10)
    at next (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/route.js:127:14)
    at module.exports (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/sails-hook-flash/lib/flash.js:108:10)
    at routeTargetFnWrapper (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/sails/lib/router/bind.js:392:9)
    at Layer.handle [as handle_request] (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/layer.js:95:5)
    at /home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/index.js:281:22
    at param (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/index.js:354:14)
    at param (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/index.js:365:14)
    at Function.process_params (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/index.js:410:3)
    at next (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/index.js:275:10)
    at next (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/route.js:127:14)
@mingjiahui
Copy link
Author

And If I follow the appconfig.json file you gave, there will be another error like:

info: Custom response `res.serverError()` called with an Error: { AdapterError: Unexpected error from database adapter: `count` failed ("badConnection").  A connection either could not be obtained or there was an error using the connection.
Additional data:

{ error: 
   { error: password authentication failed for user "admin"
    at Connection.parseE (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/pg/lib/connection.js:569:11)
    at Connection.parseMessage (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/pg/lib/connection.js:396:17)
    at Socket.<anonymous> (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/pg/lib/connection.js:132:22)
    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:601:20)

@mingjiahui
Copy link
Author

hello, @Alex99y.
I encountered the above error when running./ init.sh Command.
There is no problem in the project EXCEPT for the error in explore. Could you help me take a look, please!! I really need your help~~

@Alex99y
Copy link
Contributor

Alex99y commented Mar 19, 2021

Hello @mingjiahui ! I'm sorry, the project is no longer being maintained. Try this:

  • Check the README.md updates in Update README.md #15
  • REMOVE ALL ^ from package.json (This allow npm to install greater versions)
  • Remove node_modules and package-lock.json
  • npm install
  • ./init.sh
    If you are using Docker to set up the database, the user, password, and database name should be right. If not, you need to set up the configuration of postgresdb (Please use pgl version 11.2)

@mingjiahui
Copy link
Author

Hello @mingjiahui ! I'm sorry, the project is no longer being maintained. Try this:

* Check the README.md updates in #15

* REMOVE ALL `^` from package.json (This allow npm to install greater versions)

* Remove node_modules and package-lock.json

* npm install

* `./init.sh`
  If you are using Docker to set up the database, the user, password, and database name should be right. If not, you need to set up the configuration of postgresdb (Please use pgl version 11.2)

Yes, I'm using Docker, and I'm sure the parameters are in accordance with docker-compose.yaml to set up. And I'll try as you suggest, Thanks again!

@mingjiahui
Copy link
Author

mingjiahui commented Mar 20, 2021

Hi @Alex99y, I've tried as you suggest, but it's doesn't work for me. Could you please have a look?

图片

my docker-compose.yaml file:

version: '2'
   
services:
  posgresql:
    image: postgres:11.2
    container_name: postgresql
    ports:
      - "5432:5432"
    environment:
      POSTGRES_DB: "airmed"
      POSTGRES_USER: "airmed"
      POSTGRES_PASSWORD: "LYbAWCErGttRsP9y"
    volumes:
      - data_psql:/var/lib/postgresql/data
  redis:
    image: redis:4.0
    container_name: redis
    ports: 
      - "6379:6379"
    volumes:
      - data_redis:/data
      - ./redis.conf:/usr/local/etc/redis/redis.conf
    entrypoint: redis-server /usr/local/etc/redis/redis.conf

volumes:
  data_psql:
  data_redis:

and my appconfig.json file:
{ "email": { "admin":"admin_email@gmail.com", "auth": { "user": "admin_email@gmail.com", "pass": "password" }, "service": "Gmail", "emailVerification": 1 }, "database": { "adapter": "sails-postgresql", "user": "airmed", "password": "LYbAWCErGttRsP9y", "port": "5432", "host": "localhost", "database": "airmed" }, "session": { "name": "sails.sid", "secret": "secretKey", "redis": { "url": "redis://: redisPassword@127.0.0.1.com:6379/15", "host": "127.0.0.1", "port": 6379, "pass": "redisPassword", "db": 15 } }, "ipfs": { "host":"127.0.0.1", "port":"5001" } }

图片

@Alex99y
Copy link
Contributor

Alex99y commented Mar 20, 2021

@mingjiahui do you tried to run sails before init.sh?

@mingjiahui
Copy link
Author

@mingjiahui do you tried to run sails before init.sh?

Yes, I did. and the project can run normally except for explore.
图片

@Alex99y
Copy link
Contributor

Alex99y commented Mar 20, 2021

@mingjiahui what is not working in the explorer?. It is giving you an error? Or it is not updating the front end?

@mingjiahui
Copy link
Author

mingjiahui commented Mar 20, 2021

@Alex99y When I execute the ./init.sh command, this error occurs, and when I click explorer , the same error will appear on the front page.

@Alex99y
Copy link
Contributor

Alex99y commented Mar 20, 2021

@mingjiahui the problem might be in the sails-postgresql adapter. I'm sorry that I couldn't help with this. You need to check why the adapter is not connecting to the database, maybe need to be updated to the last version. Do you know if Sails has been connected to the database successfully?. That is because sails should create the database models after start.

@mingjiahui
Copy link
Author

@Alex99y okay, but thank you all the same!~~

@GUESSZERO4
Copy link

please,I want know which port that the server is running at

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants