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

bull-board not working with AWS serveless #485

Closed
GBShadow opened this issue Nov 17, 2022 · 12 comments
Closed

bull-board not working with AWS serveless #485

GBShadow opened this issue Nov 17, 2022 · 12 comments
Labels
wontfix This will not be worked on

Comments

@GBShadow
Copy link

GBShadow commented Nov 17, 2022

I have a problem with the bull-board, I created my bull-board application with nest and using AWS Lambda, it works normally, but the bull-board does not, when I access the route only the text "Loading..." appears, but If I start without serverless, the bull-board works normally, does anyone have any idea what it could be?

@felixmosh
Copy link
Owner

Hi @GBShadow I think that if you will ask in English, it will approach more ppl.

Anyway, I've translated your message, and looks like you have an issue with Nest & aws serverless, I'm not familiar with this setup, so If someone knows it, I will be more that happy for the help.

@samuelcole
Copy link

This is a duplicate of #444, in my opinion.

bull-board does not work in serverless environments because it uses full paths to load some files.

@felixmosh
Copy link
Owner

In serverless env the path to static assets of the ui is not calculated properly,
You can change the path to a the proper value by calling

const uiBasePath = YOUR_CORRECT_VALUE
serverAdapter
  .setViewsPath(path.join(uiBasePath, 'dist'))
  .setStaticPath('/static', path.join(uiBasePath, 'dist/static'));

after you pass it to createBullBoard function.

Can you try this and let me know if it helped you?

@samuelcole
Copy link

same error, i believe it's throwing on this line:

const uiBasePath = path.dirname(eval(`require.resolve('@bull-board/ui/package.json')`));

which is executed when running createBullBoard

if we could pass a uiBasePath to createBullBoard instead of it being calculated, that would fix it?

@felixmosh
Copy link
Owner

Probably... But i think that serverless is not a good fit anyway, since the board polling its api, you will connect to redis for each request (since serverless env is stateless)
What is the error that you get?

@samuelcole
Copy link

same error as before: #444 (comment)

@stale
Copy link

stale bot commented May 3, 2023

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 stale bot added the wontfix This will not be worked on label May 3, 2023
@stale stale bot closed this as completed May 11, 2023
@felixmosh felixmosh reopened this May 16, 2023
@stale stale bot removed the wontfix This will not be worked on label May 16, 2023
@felixmosh
Copy link
Owner

@samuelcole, Can you try v5.2.0 which allows you to pass uiBasePath from the outside?

createBullBoard({
    queues: [new BullMQAdapter(exampleBullMq)],
    serverAdapter,
    options: { uiBasePath: 'YOUR_PATH_TO_@bull-board/ui' } // <---
  });

@samuelcole
Copy link

I attempted this earlier today, but I couldn't get it working quickly because Vercel needs to be told which static files are required for the serverless bundle when it's not obvious from the imports (which it wouldn't be here...)

I know you can manually tell Vercel to include specific files, so I have hope that will work, but I got distracted by other priorities.

@fabiolnm
Copy link

@samuelcole this doesn't seem to work because node_modules isn't included into the resulting Vercel build source.

I also tried vercel/vercel#4624

!node_modules/@bull-board/ui
!node_modules/@bull-board/ui/**

and vercel/next.js#14807

// vercel.json
  "functions": {
    "src/pages/api/bull/*": {
      "includeFiles": "node_modules/@bull-board/ui/**"
    }
  }

or worse: tried to brute-force include the node_modules/@bull-board/ui directory into public (which makes Vercel include it into the build source), but none of these approaches worked, always failing w/ a message similar to:

Failed to lookup view "index.ejs" in views directory "node_modules/@bull-board/ui/dist"

Let me know if you had any success.

@stale
Copy link

stale bot commented Aug 18, 2023

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 stale bot added the wontfix This will not be worked on label Aug 18, 2023
@stale stale bot closed this as completed Sep 3, 2023
@AidanHibbard
Copy link

AidanHibbard commented Apr 17, 2024

For anyone using Nuxt 3, and Vercel who winds up here...

Here's how I got around the issue.

In your vercel.json add this (credit to spb-web)

{
  "buildCommand": "nuxt build && cp -R ./node_modules/@bull-board/ui .vercel/output/functions/__nitro.func/node_modules/@bull-board/ui"
}

Then in your bull-board config

options: { uiBasePath: `${process.cwd()}/node_modules/@bull-board/ui`, },

I tried for a while to use the includeFiles option in my vercel config, but Nuxt bundles everything into __nitro__ so it wasn't working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

5 participants