【发布时间】:2020-10-25 17:35:01
【问题描述】:
我最近被介绍到 npm instagram-web-api 并决定尝试使用它来检索用户的 pfp。
const Instagram = require("instagram-web-api");
const insta = new Instagram({});
async function getpfp(userName){
const user = await insta.getUserByUsername({ username: userName });
return user.profile_pic_url;
}
这在本地工作得很好,但是当我尝试在 Heroku 上托管的应用程序中使用它时收到一个错误。
(node:4) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'user' of undefined
at /app/node_modules/instagram-web-api/lib/index.js:152:34
我仍然不了解 Heroku 的所有细节,因此我们将不胜感激。
【问题讨论】: