Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

145
Views
Consume OData on Express.js Promise Issue

I am setting up a React backend server that I need to get data from an OData server.

I have installed the o.js package and I am following their startup guide https://www.npmjs.com/package/odata.

However, I am getting an error using the code they have provided.

TypeError: o(...).get(...).then is not a function

Here is my index.js on the Express server

const express = require("express");
const o = require('odata').o;

const PORT = process.env.PORT || 3001;

const app = express();

app.get("/api", (req, res) => {
    res.json({ message: "Hello from server!" });
});

app.get("/odata", (req, res) => {

    o('https://localhost:44335/odata')
        .get('OpenTask')
        .then((data) => console.log(data));

    res.json({ message: "odata" });
})

app.listen(PORT, () => {
  console.log(`Server listening on ${PORT}`);
});

The line o('https://localhost:44335/odata') is what is throwing the error and what is on the o.js site.

The OData service is working, as I am able to connect to it on Postman.

Why is the promise error happening?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!