bull-board icon indicating copy to clipboard operation
bull-board copied to clipboard

Bull Board UI stuck on "Loading"

Open whydnxx opened this issue 3 years ago • 19 comments

Hi, we have been looking for something to monitor our Bull Queues for quite some time. and I use Bull Board for monitor queues, I'm using Fastift rather than Express, and I have been stuck on Loading... This happened only on production, but on development all going well.

image image

Reproduce:

export const setupBullBoard = (app: NestFastifyApplication) => {
  const bullServerAdapter = new BullFastifyAdapter();
  bullServerAdapter.setBasePath('/queues/ui');

  const queues = Object.values(QUEUES).map(
    (queue) => new BullAdapter(new Queue(queue)),
  );

  createBullBoard({
    queues,
    serverAdapter: bullServerAdapter,
  });

  app.register(bullServerAdapter.registerPlugin(), {
    prefix: '/queues/ui',
    basePath: '',
  });
};

"bull": "^4.2.1" "@nestjs/core": "^8.2.5" "@bull-board/fastify": "^3.9.0"

whydnxx avatar Feb 10 '22 16:02 whydnxx

I'm not able to reproduce. I've used the with-fastify example, and change to you prefixes. All works.

If it works on dev but not on prod, it is probably a problem of mounting point, can you share the prefix that you have on prod?

felixmosh avatar Feb 10 '22 16:02 felixmosh

Here are my main.ts

import { ValidationPipe, VersioningType } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
import {
  FastifyAdapter,
  NestFastifyApplication,
} from '@nestjs/platform-fastify';
import { useContainer } from 'class-validator';
import { AppModule } from './app/app.module';
import { setupSwagger } from './configs/swagger';
import compression from 'fastify-compress';
import { contentParser } from 'fastify-multer';
import { join } from 'path';
import { setupBullBoard } from './configs/bullBoard';

async function bootstrap() {
  const app = await NestFactory.create<NestFastifyApplication>(
    AppModule,
    new FastifyAdapter(),
  );
  app.enableVersioning({
    type: VersioningType.URI,
    defaultVersion: '1',
  });
  // Enable Cors for development
  app.enableCors();
  // Enable compression
  app.register(compression);
  // File storage system
  app.register(contentParser);
  app.useStaticAssets({ root: join(__dirname, '../media'), prefix: '/media' });
  // Global Pipe to intercept request and format data accordingly
  app.useGlobalPipes(new ValidationPipe({ transform: true }));
  useContainer(app.select(AppModule), { fallbackOnErrors: true });
  setupSwagger(app);
  // Set Bull Board
  setupBullBoard(app);
  // Listen to port given by environment on production server
  // Specify '0.0.0.0' in the listen() to accept connections on other hosts.
  await app.listen(process.env.PORT || 8080, '0.0.0.0');
}
bootstrap();

whydnxx avatar Feb 12 '22 00:02 whydnxx

Pay attention that you get 504, gateway time out, it is for sure related to your prod setup

felixmosh avatar Feb 12 '22 07:02 felixmosh

yes, on my production server always loading, is my prefix that must use versioning (v1)? but, in development server is going well

whydnxx avatar Feb 12 '22 10:02 whydnxx

image

whydnxx avatar Feb 12 '22 10:02 whydnxx

can you share your url path (without the domain) of the bull ui & the API requests it made?

felixmosh avatar Feb 12 '22 10:02 felixmosh

endpoint for bull UI is : URL/queues/ui but I don't understand what API Request you mean did you mean this? swagger: /v1/docs/static/index.html bull ui: /queues/ui sample: v1/public/...

whydnxx avatar Feb 12 '22 11:02 whydnxx

can you open the console, and check where the UI makes it's api requests?

felixmosh avatar Feb 12 '22 11:02 felixmosh

it hit to queues/ui/api/queues?page=1

whydnxx avatar Feb 12 '22 11:02 whydnxx

So routes look OK. you have probably an issue with reverse-proxy on your prod env. Do you have one? (a reverse proxy)

felixmosh avatar Feb 12 '22 12:02 felixmosh

No I don't have, and I try to direct using IP and port, it same

whydnxx avatar Feb 12 '22 12:02 whydnxx

It. Is not related to IP.

You don't have nginx or something similar?

felixmosh avatar Feb 12 '22 13:02 felixmosh

finally, I found the thing that makes why it always loads, on my dev, running locally without docker. then I tried to run in my dev workspace using docker. the result is the same as in production, I use Docker in production.

Heres is my docker setup:

version: '2'
services:
  app:
    build: .
    container_name: app-api
    depends_on:
      - db
      - redis
    volumes:
      - ./src:/app/src
      - .env:/app/.env
    ports:
      - 8080:8080

  db:
    image: postgres:12
    container_name: app-db
    restart: always
    environment:
      POSTGRES_USER: root
      POSTGRES_DB: just_pay
      POSTGRES_PASSWORD: P@ssw0rd
    ports:
      - 5432:5432
    volumes:
      - postgresdata:/var/lib/postgresql

  redis:
    image: redis:5
    container_name: app-redis
    restart: always
    ports:
      - 6379:6379

volumes:
  postgresdata:

whydnxx avatar Feb 12 '22 16:02 whydnxx

So it is not related to bull-board. I keep it open just to try to help you. Maybe your connection to redis is not working when you serve the app from docker?

felixmosh avatar Feb 12 '22 16:02 felixmosh

Hi,

I have the same issue with bullboard + fastify on queues that have a large size job payload.

maxime-lenne avatar Mar 10 '22 15:03 maxime-lenne

Hi,

I have the same issue with bullboard + fastify on queues that have a large size job payload.

It is not related to the this issue. Can you open a new issue with details (job for example)?

felixmosh avatar Mar 10 '22 15:03 felixmosh

I have found the same issue, and it seemed like there was a job with null and that was causing an issue for me, so I checked that node-modules/bull-board/routes/getDataForQeues.js In the getDataForQeues function, if we use flatMap instead of map. And in the formatJob function, if we use if (!job) return [];, then I think this case could be handled, let me know, if this helps. @felixmosh Can you please do these changes to resolve this issue at least maybe.

jyotirmoy-bst avatar Mar 30 '22 06:03 jyotirmoy-bst

Hi @jyotirmoy-bst, looks like you are using a really old version of bull-board, can you update to latest and check if it solves your problem?

felixmosh avatar Mar 30 '22 07:03 felixmosh

@whydnxx can we close this issue?

felixmosh avatar May 23 '22 16:05 felixmosh

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 30 '22 19:08 stale[bot]

why this is closed? I am experiencing the same issue using 4.10.1 and the strangest thing is on local it is working on AWS I am getting 504. 🤷🏻‍♂️

fr1sk avatar Jan 11 '23 12:01 fr1sk

This issue was stale for 90 days... What is the error that you get?

felixmosh avatar Jan 11 '23 13:01 felixmosh

Make sense, but I am getting the same error. The same Redis instance on local is working, the deployed version on AWS gives me 504 after some time of loading, this is the only error that I get, nothing on server logs 😢

CleanShot 2023-01-11 at 14 07 11@2x

fr1sk avatar Jan 11 '23 13:01 fr1sk

Can we debug it somehow? will you share you screen on Discord?

felixmosh avatar Jan 11 '23 13:01 felixmosh

Unfortunately, I cannot share the code, but let's try to debug it together. My discord username is defalt#7298

fr1sk avatar Jan 11 '23 14:01 fr1sk

@fr1sk Did you ever figure this out? I am having the same problem.

axme100 avatar Jan 26 '23 19:01 axme100

@fr1sk Did you ever figure this out? I am having the same problem.

What do you get?

felixmosh avatar Jan 26 '23 19:01 felixmosh

Also have the same problem with this one on an AWS instance, works fine locally with default Redis configs. We are getting 504 when requesting BASE_URL/BASE_BULL_PATH/api/queues?page=1&jobsPerPage=10.

At first i thought this is related to the reverse proxy issue mentioned earlier by @felixmosh but it is unlikely because a similar route works, i.e: I am able to add a job via BASE_URL/BASE_BULL_PATH/add?name=PROCESS_SYNC_JOB

Aldizh avatar May 30 '23 12:05 Aldizh

While using nestjs

import { BullModule } from '@nestjs/bull';
import { ConfigModule, ConfigService } from '@nestjs/config';


BullModule.forRootAsync({
  imports: [ConfigModule],
  inject: [ConfigService],
  useFactory: async (config: ConfigService) => {
    return {
      redis: {
        host: 'your-redis-host',
        port: 'your-redis-port',
        password: 'your-redis-password-if-any',
      },
    };
  },
}),

Make use of host, port and/or password

host: 'your-redis-host',
port: 'your-redis-port',
password: 'your-redis-password-if-any',

don't use url

url: `your-redis-url`

kheengz avatar Jul 17 '23 18:07 kheengz