从 getstream.io API 检索活动 returns 未定义错误

Retrieving Activities returns undefined error from getstream.io API

我正在按照 getstream and everything went well until the "Retrieving Activities 的文档步骤进行操作。


运行

import stream from 'getstream' // stream-js v3.5.0
const client = stream.connect(APP_KEY, null, APP_ID, { location: 'eu-west' });
const user1 = client.feed('user', '1', READ_ONLY_TOKEN);

user1.get({ limit:5, offset:5 })
  .catch((errorData) => {
    console.log(errorData);
  });

给我

{
    error: undefined,
    response: {
        statusCode: 0,
        request: {
            uri: {
                protocol: "https:",
                slashes: true,
                auth: null,
                host: "api.getstream.io",
                port: null,
                hostname: "api.getstream.io",
                hash: null,
                search: "?limit=5&offset=5&api_key=...secret...&location=unspecified",
                query: "limit=5&offset=5&api_key=...secret...&location=unspecified",
                pathname: "/api/v1.0/feed/global/global/",
                path: "/api/v1.0/feed/global/global/?limit=5&offset=5&api_key=...secret...&location=unspecified",
                href: "https://api.getstream.io/api/v1.0/feed/global/global/?limit=5&offset=5&api_key=...secret...&location=unspecified"
            },
            method: "GET",
            headers: {
                stream - auth - type: "jwt",
                Authorization: "...secret...",
                ["X-Stream-Client"]: "stream-javascript-client-browser-unknown",
                accept: "application/json"
            }
        }
    }
}

有什么我可以在这里尝试的建议吗?

这是 GetStream/stream-js#99 中描述的错误,刚刚被 getstream.io 团队修复。

@JelteF:

I found out the problem. Meteor has its own browser fallback for the request lib that has a different default for withCredentials. This overrides the request browser library that I mentioned before. PR #100 should fix this by setting withCredentials explicitly.

...

I merged it into master, you can use install from there for now until it is released.

感谢大家的辛勤付出!