question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CORS issue when using meteor

See original GitHub issue

I am following the documented steps for getting started 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?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
JelteFcommented, Dec 28, 2016

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

2reactions
JelteFcommented, Dec 27, 2016

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix CORS ('Access-Control-Allow-Origin') error in ...
The best way to solve this is to move your remote API consumption code to the server, and create a Meteor method to...
Read more >
CORS on Meteor - enable cross-origin resource sharing
To add CORS authorization to a Meteor application, use the webapp package's WebApp.connectHandlers to customize HTTP headers. In order for Meteor APIs to ......
Read more >
How to add CORS headers to a Meteor app? - Stack Overflow
How it is possible to add Access-Control-Allow-Origin: * header to all responses (in particular, I am interested for static files under /public/ )...
Read more >
communitypackages:fast-render - Packosphere
You can use Meteor.subscribe in your React containers and the data will ... app adds CORS headers via connect handlers, there is a...
Read more >
Solved: REST API CORS block - Anaplan Community
Solved: Hi I can successfully connect to Anaplan using Postman. ... I did a try in Meteor.js and my requests are actually going...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found