"Only the /search endpoint is functional for Axios GET requests on the Tenor API, while the /random endpoint is

I've encountered an issue with fetching data from the Tenor API. The URL /random works on my browser but not within my code.

I know my code is correct because when I tried it with the /search endpoint, it worked perfectly fine.

Here's the snippet of my current code for the /random endpoint:

import axios from "axios";

type Result = {
  media: Array<{
    gif: {
      url: string;
    };
  }>;
};

type Results = {
  results: Result[];
};

export default async function getPadoru() {
  const res = await axios.get<Results>(
    // this URL works on the browser
    `https://g.tenor.com/v1/random?q=padoru&key=LIVDSRZULELA&limit=10&media_filter=minimal`
  );

  await console.log(res);

  return await res;
}

This piece of code using the mentioned endpoint returns the following result:

https://i.sstatic.net/Eatpf.png

In contrast, the URL used with the /search endpoint returns the correct data as expected.

https://g.tenor.com/v1/search?q=padoru&key=LIVDSRZULELA&limit=10&media_filter=minimal

https://i.sstatic.net/XYqyT.png

Answer №1

It appears that the issue lies in the latest axios version 1.2.0. After reverting back to 1.1.3, the problem was resolved successfully

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

Struggling to include an array of objects in react useState and encountering the error message 'Attempting to render objects directly in React is not valid (object found with keys {})'

I am facing an issue while trying to use React useState to add an array of objects. The error message I keep receiving is "Objects are not valid as a React child (found: object with keys {})". Here is the code snippet from my app.js file: const [users, ...

What is the reason behind Flow's reluctance to infer the function type from its return value?

I was anticipating the code to undergo type checking within Flow just like it does within TypeScript: var onClick : (() => void) | (() => boolean); onClick = () => { return true; } However, I encountered this error instead: 4: onClick = () => ...

Testing Angular Components with Jasmine and Karma: When handling the 'onChange' event, the changeEvent parameter of type MatRadioChange should not be void and must be assigned to a parameter of type

Hey there, I was working on a test for a call where I am using to emit the event: onChange(eventName: MatRadioChange): void { this.eventName.emit(eventName.value); } Here is the test I have written for it: describe('onChange', (eventName: ...

What steps can I take to prevent encountering a Typescript Error (TS2345) within the StatePropertyAccessor of the Microsoft Bot Framework while setting a property?

During the process of constructing a bot in Typescript, I encountered TS2345 error with Typescript version 3.7.2. This error is causing issues when attempting to create properties dynamically, even if they are undefined, or referencing them in the statePro ...

Issues with Angular 9 application compatibility with IE11

Our Angular 9 project runs smoothly on Google Chrome and Firefox, but nothing appears on IE11. Despite trying various solutions found online and following related blogs, the issue remains unresolved. Here is a snippet from my tsconfig.json: { // Com ...

I'm looking to make my dropdown in AngularJS more dynamic by integrating it with Firebase

Currently, I have an app developed using Ionic, TypeScript, AngularJS, and Phonegap. One of the functions in this app involves collecting information on whether the user is male or female. Initially, I created a static form for this purpose. <ion-item& ...

Exploring the Realm of Javacript Template Literal Capabilities

Is it possible to define a variable inside a template literal and then utilize it within the same template? If this isn't feasible, it appears to be a significant feature that is lacking. const sample = tag` some random words, ${let myvar = 55} addit ...

The error message indicates that the 'aboutData' property is not found within the 'never[]' data type

What is the correct method for printing array elements without encountering the error message "Property 'post_title' does not exist on type 'never[]'?" How can interfaces be used to define variables and utilize them in code for both ab ...

Discovering the 3D coordinates of a point that is perpendicular to the midpoint of a line

(I am working with Javascript/Typescript and Three.js) Given two vectors, let's say {x:1, y:3, z:5} and {x:7, y:8, z:10}, I have a direct straight line connecting them. At the midpoint of this line, envision a disc with a radius of 1 that is perpend ...

Encountering a hitch in loading Typescript modules

I'm attempting to utilize Typescript modules, but I'm encountering issues with loading them properly. Each time I try to import the module, I receive the following error message in my JS file: JavaScript runtime error: 'exports' is und ...

Angular: ensure the form reverts to its initial value when the modal is closed and reopened

I am facing an issue with my items section. When I click on an item, a modal window opens allowing me to edit the text inside a textarea. However, if I make changes to the text and then cancel or close the modal, upon reopening it, the previously modified ...

The functionality of the Ionic 4 app differs from that of an Electron app

I've encountered an issue with my Ionic 4 capacitor app. While it functions properly on Android studio, I'm having trouble getting it to work on Electron. Any ideas on how to resolve this? Here are the steps I took to convert it to Electron: np ...

The alignment of the first and second steps in Intro.js and Intro.js-react is off

There seems to be an issue here. Upon reloading, the initial step and pop-up appear in the upper left corner instead of the center, which is not what I anticipated based on the Intro.js official documentation. https://i.stack.imgur.com/ICiGt.png Further ...

Storing data in GridFS with MongoDB from an express buffer

Currently, I am attempting to save an Image file that I'm sending as multipart in my MongoDB utilizing GridFS. My approach involves using multer with the memoryStorage option. let upload = multer({ storage: multer.memoryStorage() }).single('ima ...

Navigating the JQueryUI Sortable Feature with TypeScript

Using the JQueryUI Sortable (version 1.12.1) method in a TypeScript (version 3.2.1) environment has mostly been smooth sailing for me. However, I've hit a roadblock while trying to implement the Sortable Widget's helper option. Here's a snip ...

Is it possible for Error 419 (status unknown) to be caused by a factor other than the CSRF-Token?

I'm currently facing a difficulty in resolving an issue in my application that is connected to the error mentioned above. While searching for a solution, all I come across is guidance on managing CSRF tokens and nothing else. Could it be that the err ...

How can data be transferred from a parent to a child component in Angular?

I'm facing an issue trying to pass the selected value from a dropdownlist in a user interface. I have a parent component (app.component.html) and a child component (hello.component.html & hello.component.ts). My goal is to transfer the option val ...

What is causing the error TS2339 to be thrown when attempting to access a class property in this TypeScript illustration: "Property 'text' does not exist on type 'T'"?

Could someone provide insight into why attempting to access a class property in this scenario is resulting in the error message error TS2339: Property 'text' does not exist on type 'T'. Here is the TypeScript code: class Base { rea ...

Having trouble extracting value from another component or dealing with an architectural issue?

Just recently delving into Angular, I embarked on this journey last week with a small programming foundation. My current project involves creating a simple blog application where I need to pass a value from the root (app.component.ts) to my component tag " ...

Show varying mat-options based on the selected value of another mat-select

When selecting a continent from the first mat-select, only the countries belonging to that continent should appear in the second mat-select options. For example, if Asia is chosen as the continent, only Asian countries should be displayed. <div class=&q ...