Graphql requests are failing to retrieve any data from the API

Currently delving into Next.js and GraphQL, I've come across the following code snippet.

My goal is to retrieve the specified query:

export async function getStaticProps() {
   const client = new ApolloClient({
      uri: "https://data.objkt.com/graphiql/",
      cache: new InMemoryCache(),
   })

   const{data} = await client.query({
      query: gql`
         query{
           fa2_by_pk(contract: "KT1LHHLso8zQWQWg1HUukajdxxbkGfNoHjh6") {
             floor_price
           }
         }
      `
   });
   return {
     props: {
       c: data.fa2_by_pk.floor_price,
    }
  }

}

export default function Home(c) {
   console.log(c);

Despite my efforts, the data does not seem to be returning. Instead, this is the output I receive:

{}
  [[Prototype]]: Object

What could I be doing incorrectly?

Answer №1

Upon my current visit, the endpoint appears to be an interactive igraphql endpoint. Upon examining the network request after making the same request, it seems that the correct endpoint to use is

I do not have information on what authentication may be necessary for accessing this endpoint.

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

Integrating PHP with Javascript using the Google Chart API is a powerful way to enhance

Currently, I am utilizing the google chart visualization API to work on some projects. Within my PHP code, there is a variable: `$value` This variable holds the following data: ['0', 0, 0], ['1', 65, 35], ['2', 88, 35], [&a ...

Troubleshooting Three JS Projection Challenges

I have been attempting to find the centroid of a polygon in 3D space and then convert its vertices to 2D screen coordinates. Unfortunately, the code I currently have is not producing the desired results. I would greatly appreciate any assistance with this ...

Is there a way to make a text area box visible using JavaScript?

Currently, I am developing an automation script in Python using Selenium. My objective is to make a textarea box visible, as I need to insert some arguments into it. Here is the code snippet that I am utilizing: element = driver.find_element_by_id('g ...

"An intermittent error is occurring with the jQuery webcam plugin, where a TypeError is being thrown stating that

Many times, I encounter the error stated in the subject line. The code snippet where this error occurs is within the else section of the function below: if ($('#clicktosnap').is('.disabled')) { alert ("Please enable the camera first, ...

What could be the reason behind the error encountered while attempting to parse this particular JSON object?

I am encountering an issue with my PHP (Codeigniter Framework) code: $webpages = $this->webpageModel->select('webpageID,webpageTitle')->where('webpagecategoryID', $webpagecategoryID)->findAll(); header('Content-Type: ap ...

Steps for inserting a JSON Array into a database

I have a dropdown menu that displays different options based on the selection from another dropdown. The data for each dropdown is fetched from the database and I need to insert the selected values into a new table in the database. All the necessary code ...

Issue with updating onclick attribute of popover in Bootstrap 4

My goal is to design a popover in bootstrap 4 with a nested button inside it. However, when I update the data-content attribute of the popover with the button element, the element gets updated but the onclick attribute goes missing. I have experimented wi ...

The $geoNear operator must be the initial stage in a pipeline to be valid

When performing an aggregation using nodejs as the server-side language, I encountered the error message $geoNear is only valid as the first stage in a pipeline. This is the Aggregation Object: [ { '$geoNear': { near: [Object], distanceFie ...

Storing a PDF created with Laravel in a queue

I have a tool that converts HTML to PDF and saves it locally. I also use a live URL to fetch another PDF and save it on my local machine. Then, I utilize a Laravel library to merge both PDFs into a single file through embedding. Previously, this process ...

What is the best way to restrict event handling to only occur once every X seconds using jQuery or JavaScript?

Is there a way to limit handling the event of a rapidly-firing keypress to once per X seconds using jQuery or vanilla JavaScript? Check out this jsfiddle that demonstrates rapid keypress firing without any limiting on the handling: View here ...

Tips for initiating a PHP class method through AJAX

As someone who is just starting to learn about ajax, I'm currently facing a challenge with calling the get_mother method through ajax in my form's textbox change event. My goal is to display the results in a datalist by using the following code. ...

What do cross-domain requests, cross-domain attacks, and cross-domain protocols entail?

Can anyone provide clarification on the concepts of cross domain requests, cross domain attacks, and cross domain protocols as they relate to the AJAX terminology? ...

Altering the hue of various stroke patterns

I've encountered an issue where I want to create skill bars that display my skills in percentages. Luckily, I found a great code that allows me to do this. Although I would prefer to do it myself, I haven't come across a good tutorial that teache ...

Node JS Axios Network Error due to CORS Policy Restrictions

When attempting to make a put axios request, I encounter the following error: https://i.sstatic.net/aBQGI.png I have installed and enabled the CORS module in the server.js file, but it doesn't seem to be working. Additionally, there are no CORS head ...

What is the method for obtaining the value of a React-Select option?

Is it possible to extract the value from the unitOptions array in a React-Select component and then pass it to an Express file for serving as an OpenWeather URL to display weather information? Thank you for your assistance. import React, {useState} from ...

Ways to display "No records" message when the filter in the material table in Angular returns no results

How can I implement a "No Records Message" for when the current table is displaying empty data? Check out this link for examples of material tables in AngularJS: https://material.angular.io/components/table/examples ...

undefined value being returned by a mongoose schema function

I'm working on a method to validate a user's password using bcrypt.compare(). See the code snippet below for details. UserSchema.methods.validatePassword = async (data) => { console.log(this.email); // returns undefined console.log(this.fi ...

extracting numerical values from a string using javascript

Currently, I am engaged in a project that requires extracting phone numbers from a string. The string is stored in a JavaScript array called dine. { "group": 1, "tel1": "Tél(1): 05.82.77.31.78", "tel2": "Tél(2): 09.55.86.31.45", }, ,... My goal i ...

jQuery DataTable error: Attempted to set property 'destroy' on an undefined object

<script> $('#archiveTable').DataTable({}); </script> <table id="archiveTable" datatable="ng" class="table table-sm" style="color:black"> <!--some code--> </table> This is a snippet of HTML code Upon checking t ...

In React Native, changing the translation of an element causes it to shift below all other elements, regardless of

Check out this sandbox project: I'm trying to create a simple animation using translation in React Native, but I'm facing an issue where when I move the element to the right and down, it goes under other elements. However, if I move it left and ...