paritytech / polkadot-testnet-faucet

https://faucet.polkadot.io/
MIT License
36 stars 34 forks source link

📡 Problem with running the Faucet #442

Closed lalitsharma-zeeve closed 2 months ago

lalitsharma-zeeve commented 2 months ago

Faucet Type

Web

Problem

I am trying to run faucet locally following the steps:-

OS: ubuntu 20.04 node version: v20.17.0

  1. git clone https://github.com/paritytech/polkadot-testnet-faucet
  2. copy .env file from example given in above repo
  3. yarn install yarn generate:papi yarn simple-git-hooks 3.5 sudo chmod 777 /home/user/faucet/polkadot-testnet-faucet/data
  4. yarn dev:db
  5. yarn build yarn migrations:run
  6. Register on app.element.io —> get access token
  7. yarn dev
  8. .env file content
    
    SMF_CONFIG_NETWORK="westend"

SMF_CONFIG_PORT=5555 SMF_CONFIG_DEPLOYED_REF=local

Steps to retrieve this token:

1. Create a bot account (see instructions below for SMF_BOT_MATRIX_BOT_USER_ID)

2. Log in to the bots matrix account. Click on the name in the top left corner, then "Settings".

3. Click the "Help & About" tab (left side of the dialog).

4. Scroll to the bottom and click on part of Access Token.

Note: Keep the browser login active as the token will be invalidated once you logout

SMF_CONFIG_MATRIX_ACCESS_TOKEN="syt_bGFsa....mBgO_12UyAY"

See https://github.com/paritytech/devops/wiki/Matrix%3A-Registering-a-Matrix-Bot for how to register a bot

Note: The bot account needs to be created in SMF_BOT_MATRIX_SERVER

SMF_CONFIG_MATRIX_BOT_USER_ID="@lalitkumarzeeve:matrix.org"

SMF_CONFIG_MATRIX_BOT_USER_ID="!GitLbaPCZaPQunjvHN:matrix.org"

SMF_CONFIG_MATRIX_BOT_USER_ID="@NotValidExampleAccount:matrix.parity.io"

@lalitkumarzeeve:matrix.org

SMF_CONFIG_FAUCET_IGNORE_LIST="" SMF_CONFIG_MATRIX_SERVER=https://m.parity.io

SMF_CONFIG_MATRIX_SERVER=https://app.cinny.in/

To get account mnemonic - create an account in https://polkadot.js.org/apps/#/accounts (save details in password manager)

Prior creating, make sure to switch to according network (in case of westend - TEST WESTEND & PARACHAINS => Westend)

To feed new account with test tokens, go to https://matrix.to/#/#westend_faucet:matrix.org and drip to new address

some convenient for tests amount "!drip
"

SMF_CONFIG_FAUCET_ACCOUNT_MNEMONIC="ridge some words here and there copy advice away vivid believe giant"

Only used with external access

SMF_CONFIG_RECAPTCHA_SECRET="6LeIxAcTA....FuojJ4WifJWe" # Public testing secret, will accept all tokens.

Database

SMF_CONFIG_DB_HOST=localhost SMF_CONFIG_DB_PORT=5432 SMF_CONFIG_DB_USERNAME=postgres SMF_CONFIG_DB_PASSWORD=postgres SMF_CONFIG_DB_DATABASE_NAME=faucet


I am seeing following error for westend network:-

] }
[1] Token no longer valid - assuming logout
[1] SyncApi.stop
[1] Checking lazy load status...
[1] Checking whether lazy loading has changed in store...
[1] Storing client options...
[1] Stored client options
[1] Getting filter...
[1] Getting filter failed M_UNKNOWN_TOKEN: MatrixError: [401] Invalid access token passed. (https://m.parity.io/_matrix/client/r0/user/%40lalitkumarzeeve%3Amatrix.org/filter)
[1]     at parseErrorResponse (/home/lalit/faucet/polkadot-testnet-faucet/node_modules/matrix-js-sdk/lib/http-api/utils.js:81:12)
[1]     at MatrixHttpApi.requestOtherUrl (/home/lalit/faucet/polkadot-testnet-faucet/node_modules/matrix-js-sdk/lib/http-api/fetch.js:244:44)
[1]     at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
[1]   httpStatus: 401,
[1]   url: 'https://m.parity.io/_matrix/client/r0/user/%40lalitkumarzeeve%3Amatrix.org/filter',
[1]   event: undefined,
[1]   errcode: 'M_UNKNOWN_TOKEN',
[1]   data: {
[1]     errcode: 'M_UNKNOWN_TOKEN',
[1]     error: 'Invalid access token passed.',
[1]     soft_logout: false
[1]   }
[1] }
[1] Token no longer valid - assuming logout
[1] SyncApi.stop
[1] INFO (app): Faucet balance update. It's now 30 WND
[1] INFO (app): Faucet balance fetched, it's now 30 WND

### Address

_No response_

### Network ID

westend

### Relevant log output

```Shell
] }
[1] Token no longer valid - assuming logout
[1] SyncApi.stop
[1] Checking lazy load status...
[1] Checking whether lazy loading has changed in store...
[1] Storing client options...
[1] Stored client options
[1] Getting filter...
[1] Getting filter failed M_UNKNOWN_TOKEN: MatrixError: [401] Invalid access token passed. (https://m.parity.io/_matrix/client/r0/user/%40lalitkumarzeeve%3Amatrix.org/filter)
[1] at parseErrorResponse (/home/lalit/faucet/polkadot-testnet-faucet/node_modules/matrix-js-sdk/lib/http-api/utils.js:81:12)
[1] at MatrixHttpApi.requestOtherUrl (/home/lalit/faucet/polkadot-testnet-faucet/node_modules/matrix-js-sdk/lib/http-api/fetch.js:244:44)
[1] at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
[1] httpStatus: 401,
[1] url: 'https://m.parity.io/_matrix/client/r0/user/%40lalitkumarzeeve%3Amatrix.org/filter',
[1] event: undefined,
[1] errcode: 'M_UNKNOWN_TOKEN',
[1] data: {
[1] errcode: 'M_UNKNOWN_TOKEN',
[1] error: 'Invalid access token passed.',
[1] soft_logout: false
[1] }
[1] }
[1] Token no longer valid - assuming logout
[1] SyncApi.stop
[1] INFO (app): Faucet balance update. It's now 30 WND
[1] INFO (app): Faucet balance fetched, it's now 30 WND
mutantcornholio commented 2 months ago

Well the error is invalid token for matrix bot.
I can imagine that you wanted to use matrix.org instead of m.parity.io in SMF_CONFIG_MATRIX_SERVER variable?

lalitsharma-zeeve commented 2 months ago

Thanks it is working!