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

119
Views
Node js HTTPS get request for Instagram post information (?__a=1) request returning 301 status code in Vercel

I'm trying to get public post information from Instagram using this - https://instagram.com/p/{id}?__a=1 link in Node.js using https get request.
The problem is that it works in my local server but as soon as I deploy my code in Vercel server-less function the data event inside https get response never gets fired which leaves my data to be empty string.

const getPostInfo = (url) => {
    return new Promise((resolve, reject) => {
        let data = "";
        https
            .get(url, (res) => {
                console.log(res.statusCode); // 301
                res.on("data", (chunk) => {
                    data += chunk.toString();
                });
                res.on("end", () => {
                    console.log(data); // Empty string
                    data = JSON.parse(data); // Parse error
                    resolve(data);
                });
            })
            .on("error", (err) => {
                console.log(err);
                reject(err);
            });
    });
};

I've think the problem is with the instagram link it returns status code 301. I have tried some other get requests from other API's and it seems to be working fine.
I've also tried using Array buffer and also used different libraries like request and node-fetch but no luck.
Please tell me what am I doing wrong.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I think it's because in my country (INDIA) the '?__a=1' API works but in other country like USA its requires you to login to Instagram and the default Vercel server is located in USA so the data event never gets fired.

about 4 years ago · Juan Pablo Isaza Report
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!