Retrieving Activities returns undefined error from getstream.io API

317 views Asked by At

I am following the documentation steps of getstream and everything went well until the "Retrieving Activities" step.


Running

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);
  });

gives me

{
    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"
            }
        }
    }
}

Any suggestion of what I could try here?

1

There are 1 answers

0
zVictor On BEST ANSWER

It was a bug, described at GetStream/stream-js#99, that has just been fixed by the getstream.io team.

@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.

Thank you all for the hard work!