Encountering an issue with Meteor and node-celery: "Unable to access property 'slice' of null"

Check out the Github repository for reproducing this issue Run localhost:3000 to replicate the problem.

In my setup with Meteor 1.4.4.1, I am utilizing the node-celery npm packages on the server side. Upon Meteor initialization, the client automatically invokes the Meteor method estimates.request, leading to the addition of a task in the queue:

client/main.js

Meteor.startup(() => {
    Meteor.call('estimates.request', function(err) {
        console.log('ok')
    })
});

This call triggers the execution of the following Meteor method:

imports/api/Estimates.js

Meteor.methods({
    'estimates.request'() {
        console.log('estimates.request called');

        // Initialize Celery client
        var celery = require('node-celery')
        var client = celery.createClient({
            CELERY_BROKER_URL: 'amqp://192.168.1.26:5672//',
            CELERY_RESULT_BACKEND: 'amqp'
        });

        // Queue task upon connection
        client.on('connect', function() {
            console.log('connected');
            start_latitude = 1.3053947
            start_longitude = 103.8273045
            client.call('proj.tasks.getPriceEstimates', [start_latitude, start_longitude],
                function(result) {
                    console.log('result: ', result);
                    client.end();
                })
        });
    }
});

This process results in the following error message:

Exception while invoking method 'estimates.request' TypeError: Cannot read property 'slice' of null

Question: What could be the underlying cause of this error?

Visit the GitHub repository to reproduce and troubleshoot this issue Run localhost:3000 to trigger the problem.

Answer №1

After encountering a similar issue, I discovered an error in the node celery documentation regarding the CELERY_RESULT_BACKEND option.

To resolve this issue, you need to configure the option as follows:

CELERY_RESULT_BACKEND: 'amqp://' and everything should function properly.

Celery reads the URL and parses the protocol, so if you input amqp, Celery will throw an exception.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Obtaining the current user's ID and adding it to the URL of a function in NodeJS

Is it possible to include the current user's ID in the URL parameter for my Express patch method? I know I can retrieve the ID from the Axios request, but how can I pass it without using a separate method? Any insights on this issue would be greatly a ...

Having trouble creating an angularjs table using ng-repeat in the controller?

I have a sample snippet that I would like to discuss. My goal is to display a JSON object in an angular table using ng-repeat, which is being generated from my angular controller script. I have attempted the code below, but for some reason, the table is no ...

Unable to use global modules in NestJS without importing them

Currently, I am in the process of integrating a global module into my nest.js project I have written a service as shown below: export interface ConfigData { DB_NAME: string; } @Injectable() export class ConfigManager { private static _inst ...

Ways to insert HTML text into an external webpage's div element without using an iframe

Is it possible to generate HTML and SVG code based on the position of a Subscriber on a web page or within a specific div? I would like to provide some JavaScript code that can be inserted inside a particular div on the page. Using an iframe is not ideal ...

What is the best way to add a simple Search bar to the Material UI Data Grid component?

If we take a look at this data grid example: check it out here I'd like to incorporate a simple search bar similar to the one shown here Can someone provide guidance on how to add this feature to Data Grid MUI? ...

Managing unique tokens in Express.js: A comprehensive guide

Currently using a node express app, I am aware of 'jsonwebtoken' and 'express-jwt' for token management. However, if the token is not generated by jsonwebtoken, how can I still protect my API using a token? ...

Is it possible to transform an arrow function into a regular function?

Currently, I am working my way through the AJAX type ahead course in Javascript 30 by Wes Bos. As I progress through this course, I have made a conscious effort to minimize my use of ES6 features for the sake of honing my skills. If you want to see the fi ...

Executing the command "node-gyp rebuild" will produce a build log in the file "build_log.txt", and any errors will be redirected

<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="90e5e7e3d0a9bea1a4bea0">[email protected]</a> install /var/www/html/my-app/node_modules/uws node-gyp rebuild > build_log.txt 2>&1 || exit 0 Error: There ...

Strategies to verify if two objects of the same class possess the same attribute

I have multiple elements with the same class and unique attribute values, such as: <div class="myclass" data-attr="1"></div> <div class="myclass" data-attr="2"></div> <div class="myclass" data-attr="3"></div> <div cl ...

Creating a scrolling effect similar to the Nest Thermostat

After researching countless references, I am determined to achieve a scrolling effect similar to the Nest Thermostat. I came across this solution on this JSFiddle, but unfortunately, the parent element has a fixed position that cannot be utilized within my ...

What steps can be taken to address the UnhandledPromiseRejectionWarning?

Greetings and good day to you! I am facing an issue with user authentication. When I try to log in a registered user, it gets stuck loading forever and shows an error message: "UnhandledPromiseRejectionWarning: ReferenceError: Invalid left-hand side ...

Tips for adding responses to input fields in AngularJS

I am looking to populate data into 3 inputs based on the JSON response I receive from my node server. However, despite receiving a response, I am unable to input it into the designated fields. Controller: $scope.edit = function(id, contact) { console.log ...

When Firebase cli is not installed globally, you might encounter issues when trying

Currently using my work computer to work on a side project where I am exploring new features of Firebase. However, I ran into an issue since I am unable to install modules globally on this corporate device. When trying to install firebase-cli with the reco ...

Is it possible to customize the color of icons in react's Material-table?

I'm currently utilizing the material-table library and I'm struggling to individually change the color of each icon. Could you assist me with this? I attempted custom CSS, but it's affecting all icons at once instead of specific ones. Here i ...

The controller's AngularJS function seems to be unresponsive

Issue with AngularJs ng-click Event I'm attempting to utilize the GitHub Search-API. When a user clicks the button, my Controller should trigger a search query on GitHub. Here is my code: HTML: <head> <script src="js/AngularJS/angula ...

Oops! Looks like there was an error. The text strings need to be displayed within a <Text> component in the BottomTabBar. This occurred at line 132 in the

My app includes a bottomTab Navigation feature, but I encountered an error: Error: Text strings must be rendered within a <Text> component. This error is located at: in BottomTabBar (at SceneView.tsx:132) in StaticContainer in StaticCont ...

What makes 'Parsing JSON with jQuery' unnecessary?

Just performed an ajax request with a query and noticed that my response is already in the form of a JavaScript object. When I try to parse the JSON using: var obj = jQuery.parseJSON(response); 'obj' turns out to be null, yet I can directly ac ...

How to locate the index.js file within my application using Node.js?

Directory Structure bin - main.js lib - javascript files... models - javascript files... node_modules - folders and files public - index.html route - javascript files... index.js package.json I am using Express and angular.js. The ser ...

Is it possible for npm install to disregard development dependencies during the installation process

In a Node.js project, running npm install will install both the dependencies and dev dependencies. To skip installing dev dependencies, you can use npm install --production. Question 1: If I don't include --production, will the dependencies' dev ...

What is the best way to create operating system-neutral file paths in Node.js?

I'm currently fixing issues with my code while running integration tests on an EC2 instance of a Windows machine. Despite resolving the filenames-are-too-long problem, several paths remain unresolved due to being hardcoded for UNIX systems. I've ...