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.

NewsAPIError: parametersIncompatible

See original GitHub issue

Tried to get news with the following example from official website

const NewsAPI = require('newsapi');
const newsapi = new NewsAPI('7bfd3e755d524648883ebae00d2280f7');

  sources: 'bbc-news,the-verge',
  q: 'bitcoin',
  category: 'business',
  language: 'en',
  country: 'us'
}).then(response => {
      status: "ok",
      articles: [...]

but keep getting error ‘You cannot mix the sources parameter with the country or category parameters’. When I remove sources I don’t get any articles back. node version 9.11. running on local express server

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

bzarrascommented, May 20, 2018

@ihorbond Thanks for pointing this out. The example usage of the v2.topHeadlines is misleading in that it demonstrates that sources, country, and category are available parameters to pass, but according to the official NewsAPI top-headlines docs, country and category can not be used simultaneously with sources.

I would guess that the reason you got no articles back after removing sources is that there simply were no recent top headlines that were categorized as “business” and contained the query “bitcoin”.

I will update my usage examples to address this. I recommend to always refer to the official NewsAPI docs when looking for which parameters are valid and what kind of values they accept.

nh303commented, Jun 17, 2021

Can you please update the document, so that no new developer finds these issues again? It will be really helpful.

Thank You

Read more comments on GitHub >

github_iconTop Results From Across the Web

Errors - Documentation - News API
The request was executed successfully. 400 - Bad Request . The request was unacceptable, often due to a missing or misconfigured parameter. 401...
Read more >
Terms - News API
Accuracy of materials. The materials appearing on News API's website could include technical, typographical, or photographic errors. News API ...
Read more >
Everything - Documentation - News API
This parameter is useful if you have an edge case where searching all the fields is ... In the case of error a...
Read more >
Errors - Documentation - News API
Guides. By now you may be familiar with the API and how to make requests, but still have questions about how to use...
Read more >
Bing News Search API v5 Reference - Microsoft Learn
Describes the v5 iteration of the News Search API and provides technical details about the query parameters to request news articles.
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 Post

No results found

github_iconTop Related Hashnode Post

No results found