metaplex-foundation / amman

A modern mandatory toolbelt to help test solana SDK libraries and apps on a locally running validator.
https://metaplex-foundation.github.io/amman/docs/
Apache License 2.0
71 stars 17 forks source link

Address label fetch error #27

Open lwus opened 2 years ago

lwus commented 2 years ago

Fails to start. Console output is

Running validator with 3 custom program(s) preloaded
Spawning new solana-test-validator with programs predeployed and ledger at /var/folders/5m/vqbbq3kd4yq047ml6536k52h0000gn/T/amman-ledger
solana-test-validator is up
> Streaming transaction logs. Confirmed commitment
Waiting for fees to stabilize 1...
/opt/homebrew/lib/node_modules/@metaplex-foundation/amman/dist/relay/client.js:68
            const timeout = (0, timeout_1.createTimeout)(2000, new Error(AMMAN_UNABLE_FETCH_LABELS + AMMAN_NOT_RUNNING_ERROR), reject);
                                                               ^

Error: Unable to connect to fetch address labels, is amman running with the relay enabled?
If not please start it as part of amman in a separate terminal via `amman start`
Make sure to set `relay: { enabled: false }` in `.ammanrc.js`.
Alternatively set environment var `CI=1` in your current terminal or
instantiate amman via `const amman = Amnnan.instance({ connectClient: false })`
    at /opt/homebrew/lib/node_modules/@metaplex-foundation/amman/dist/relay/client.js:68:64
    at new Promise (<anonymous>)
    at ConnectedAmmanClient.fetchAddressLabels (/opt/homebrew/lib/node_modules/@metaplex-foundation/amman/dist/relay/client.js:67:16)
    at AddressLabels.getRemoteLabelAddresses (/opt/homebrew/lib/node_modules/@metaplex-foundation/amman/dist/diagnostics/address-labels.js:201:53)
    at new AddressLabels (/opt/homebrew/lib/node_modules/@metaplex-foundation/amman/dist/diagnostics/address-labels.js:126:14)
    at Function.setInstance (/opt/homebrew/lib/node_modules/@metaplex-foundation/amman/dist/diagnostics/address-labels.js:271:35)
    at Function.instance (/opt/homebrew/lib/node_modules/@metaplex-foundation/amman/dist/api.js:127:65)
    at cliAmmanInstance (/opt/homebrew/lib/node_modules/@metaplex-foundation/amman/dist/cli/utils/resolvers.js:7:24)
    at handleStartCommand (/opt/homebrew/lib/node_modules/@metaplex-foundation/amman/dist/cli/commands/start.js:37:76)
    at async main (/opt/homebrew/lib/node_modules/@metaplex-foundation/amman/dist/cli/amman.js:133:34)

Node.js v17.8.0

With config

'use strict';
// @ts-check
const { LOCALHOST, tmpLedgerDir } = require('@metaplex-foundation/amman');
const base = require('../../.ammanrc.js');

const validator = {
  ...base.validator,
  jsonRpcUrl: LOCALHOST,
  programs: [
      base.programs.metadata, 
      base.programs.tokenEntangler, 
      base.programs.tokenFuser
    ],
};

const relay = {
  enabled: false
}
module.exports = { validator, relay };
ngundotra commented 2 years ago
thlorenz commented 2 years ago

Yeah you need to either enable the relay or run the tests with in a terminal with the env varCI=1.

The relay is expected to be enabled except in a CI environment like github actions.

thlorenz commented 2 years ago

also, amman does not work if solana config url is pointing at anything other than localnet

that one seems a different issue (that I thought I solved recently) so please open up a separate issue for that with more details.

thlorenz commented 2 years ago

BTW running without the relay enabled will prevent the amman explorer from presenting you with any of the extra features, so you get no more diagnostics than the stock explorer already provides.

Therefore it is assumed when working locally that you enable it.

thlorenz commented 2 years ago

I also fixed the following message:

Make sure to set `relay: { enabled: false }` in `.ammanrc.js`.

Should've been:

Make sure to set `relay: { enabled: true }` in `.ammanrc.js`.

Sorry about this .. was saying the except opposite of what you should do.

thlorenz commented 2 years ago

Hi did this issue get resolved for you?

staccDOTsol commented 1 year ago

It seems like there is an error with the address label fetch. The error message suggests that the Amman client is not running with the relay enabled. You can try starting the Amman client with the relay enabled by running amman start in a separate terminal window. If that doesn't work, you can try setting relay: { enabled: false } in your .ammanrc.js file. Alternatively, you can set the environment variable CI=1 in your current terminal or instantiate Amman via const amman = Amnnan.instance({ connectClient: false }).