question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RabbitMq client still a Promise on App start up

See original GitHub issue

Describe the bug Following the Marble docs for creating an amqp publisher I receive the following error on app start-up (node:90349) UnhandledPromiseRejectionWarning: TypeError: rabbitMqClient.send is not a function because the resolved rabbitMQ client is still a Promise even though it was eagerly bounded to the context

To Reproduce Amqp publisher

export const AmqpClientToken = createContextToken<MessagingClient>('MessagingClient');
export const amqpClient = messagingClient({
    transport: Transport.AMQP,
    options: {
        host: 'amqp://localhost:5672',
        queue: 'hello_queue'
    },
});

Http effect

export const getRoot$ = r.pipe(
    r.matchPath('/'),
    r.matchType('GET'),
    r.useEffect((req$, ctx) => {
        const rabbitMqClient = useContext(AmqpClientToken)(ctx.ask);

        return req$.pipe(
            mergeMapTo(rabbitMqClient.send({ type: 'HELLO', payload: 'John' })),
            mapTo({ status: HttpStatus.ACCEPTED }),
        );
    }),
);

App

const httpServerListener = httpListener({
    middlewares: [
        logger$({ silent: isTestEnv() }),
        bodyParser$(),
    ],
    effects: [
        getRoot$
    ],
});

export const server = createServer({
    port: getPortEnv(),
    listener: httpServerListener,
    dependencies: [
        bindEagerlyTo(AmqpClientToken)(amqpClient),
    ],
});

export const main: IO.IO<void> = async () =>
    await (await server)();

Expected behavior App starts up.

Desktop (please complete the following information):

  • OS: Ubuntu
  • Package + Version: Marble ^3.4.9
  • Node version: 14.15.4

Additional context

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
JozefFlakuscommented, Jun 24, 2021

@paulvitic any updates in this topic?

0reactions
robert-grunercommented, Mar 31, 2022

Unfortunately this issue seems stale. Anyways @JozefFlakus we tried to get Marble running with an RabbitMq and failed as well. We even checked out marble source code, ran “yarn” and “yarn build”. “yarn test:integration” does show that there might be a real problem with messaging since the tests are red. The script downloaded the latest “rabbitmq:management”. Maybe you can have a look?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - RabbitMq client still a Promise on App start up -
Describe the bug. Following the Marble docs for creating an amqp publisher I receive the following error on app start-up
Read more >
RabbitMQ tutorial - Work Queues
We have learned how to make sure that even if the consumer dies, the task isn't lost. But our tasks will still be...
Read more >
Getting started with RabbitMQ in Spring Boot - Medium
App goes from dev environment to test environment, you need to create the queues. App goes to production, someone needs to create them....
Read more >
How to make waiting for the completion of actions, then ...
What you want to have is usually accomplished with consumer acknowledgments. You can read about them here. In short, your consumer (in your ......
Read more >
Subscriptions in Apollo Server - Apollo GraphQL Docs
To run both an Express app and a separate WebSocket server for subscriptions, ... Next, in order to set up both the HTTP...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found