Activities

michaelyiu

michaelyiu posted a new question

apollo-module •

apolloHelpers not working as intended

Or it could be a matter of config. The $apolloHelpers.hasToken() method always returns false for me, although cookies are being set to the browser by $apolloHelpers.login(). This leads me to believe that perhaps it's not being set correctly? However, my config is rather simple.

export default function ({ req }) {
return {
cache,
clientConfigs: {},
httpEndpoint: "http://localhost:4000/graphql",
httpLinkOptions: {
credentials: "include"
},
}
}

I've been trying to run the default middleware as seen in the nuxt-apollo docs but the token has been returning false the entire time.. taking the double bang off, it's been returning undefined.

michaelyiu

michaelyiu resolved the question #c207

apollo-module •

Browser refresh causing apollo client to stop sending cookies to backend

I may not have rebuilt the project as it's actually working for me now..

LuXDAmore

LuXDAmore posted a new bug report

apollo-module •

bug Memory leak with Smart Query

Version

v4.0.0-rc.7

Reproduction link

https://codesandbox.io/s/nuxt-apollo-smart-query-bug-v585k

Steps to reproduce

  • Install apollo-module for Nuxt;
  • Use a Smart query in a page.

What is expected ?

The GarbageCollector can free up the memory after every page reload.

What is actually happening?

Visiting pages with Smart query cause the memory to continue to grow up without stopping.
After ~ 15000 urls (depends on how much HTML there is in page) the server is out of memory.

Additional comments?

Using apolloProvider.defaultClient.query in asyncData it's ok.

There's a library installed in the demo to bulk-test urls, 'npm run siege'. With that it's possible to see the memory growing up.

negezor

negezor posted a new question

apollo-module •

An alternative approach to Smart Query

For a long time, I used the direct call of Apollo from asyncData. Since I need to return 404 page if the data is missing. But with this approach, I lose Smart Query functionality. It would be nice to think of an opportunity to process Nuxt.js context in it after the result.

michaelyiu

michaelyiu posted a new question

apollo-module •

Browser refresh causing apollo client to stop sending cookies to backend

Hi, there's something a little funky on browser refresh that I'm not really sure how to fix. So I've been able to implement refresh tokens on the backend which works great in the playground. The only feature that I do not have set up for that yet is invalidating the old tokens. I'm storing the tokens in cookies which apollo client receives(both access & refresh token) when I run a login mutation. I ran out the time and everything seems to be working. I also have a currentUser check on each page. Since the queries are cached automatically, it usually only runs once.

However, when I refresh the page, currentUser returns undefined. BUT. The tokens are still in the browser! Under cookies, it does disappear for a split second so I'm not sure if apollo-client is being loaded without the tokens thus is a new Apollo instance? I'm wondering if anyone has encountered this issue before?

Attached is my cut down version of the apollo config and page and the problem still persists.

apollo config.jpg
page.jpg

edit: I'm not really sure if this is an Apollo issue or a Vue issue specifically, any help would be greatly appreciated!

ducong123

ducong123 posted a new question

apollo-module •

nuxt apollo 订阅

nuxt apollo 订阅功能怎么配置和实现,

zachheine

zachheine posted a new bug report

apollo-module •

bug default.httpEndpoint parameter not working with non-http link

Version

v4.0.0-rc.6

Reproduction link

https://jsfiddle.net/28xvoum1/2/

Steps to reproduce

I am using netlify functions to run the GraphQL server and normally make requests to /.netlify/functions/graphql so that it works locally and when deployed. However, the default.httpEndpoint parameter is not working with this link.

What is expected ?

I use the link that I use in normally http requests and it works.

What is actually happening?

Requires http:// prefix.

750973092

750973092 posted a new question

apollo-module •

The method in the file corresponding to errorHandler is not executed

The method in the file corresponding to errorHandler is not executed

750973092

750973092 posted a new question

apollo-module •

Error Handler Item Links Past Link Files Error, but no Execution Method What's the matter

image

mdskinner

mdskinner posted a new bug report

apollo-module •

bug TypeError Cannot read property 'freezeResults' of null

Version

v4.0.0-rc.5

Reproduction link

https://codesandbox.io/s/codesandboxnuxt-kdgpg?fontsize=14

Steps to reproduce

clean install - implement @nuxtjs/apollo as described
Screenshot 2019-05-22 at 12.00.37 PM.png

What is expected ?

apollo to be implemented

What is actually happening?

TypeError
Cannot read property 'freezeResults' of null

mdskinner

mdskinner posted a new question

apollo-module •

Cannot read property 'freezeResults' of null

I'm getting this on a clean install of nuxt after following the basic steps to implement in nuxt.config.js

There must be more to the configs?

Screenshot 2019-05-22 at 12.00.37 PM.png

renestalder

renestalder posted a new question

apollo-module •

Installing Vue on top of Nuxt might break Typescript

This is not exactly a problem of this module, but rather a documentation issue.

The readme currently shows the installation of Nuxt on top of Vue. Actually, to use Nuxt, Vue doesn't has to be installed separately and I actually found that installing this module with by following the README, it breaks the Vetur (Visual Studio Code plugin) support as soon as I install Vue on top of Nuxt. At least that's my current assumption after testing.

So I wonder, what's the reason that the module claims to require a separate Vue dependency installation?

Teeoo

Teeoo posted a new question

apollo-module •

Apollo data is only available after the page is refreshed
apollo: {
    ArticlebyID: {
      query: gql`
        query($id: Int) {
          ArticlebyID(id: $id) {
            id
            title
            slug
            text
            html
            order
            cover
            summary
            category {
              label
            }
          }
        }
      `,
      prefetch: true,
      fetchPolicy: 'cache-and-network',
      update(data) {
        return data.getQuotationWithRepliesRanked
      },
      variables() {
        return {
          id: Number.parseInt(this.$route.params.id)
        }
      }
    }
  }

When I add category { Label } The page needs to be refreshed, otherwise it is Cannot read property 'label' of undefined. Why is this?

sebmor

sebmor posted a new question

apollo-module •

onLogin supporting SSR

I am logging in a user through an API that sends back a bunch of headers.

Currently this.$apolloHelpers.onLogin only works on the client through js-cookie. It would be nice to also make it work on the server.

drewbaker

drewbaker posted a new bug report

apollo-module •

bug Customizing global errorHandler fatal crashes server

Version

v4.0.0-rc.4

Reproduction link

https://codepen.io/drewbaker/pen/gJMvoO

Steps to reproduce

1) In nuxt.config.js just define the example errorHandler as shown in the docs. It's enough to just do a simple console.log(error) too.
2) Make a GQL request, requesting something that doesn't exists (like links instead of link) and the server will crash.
3) The server will crash with a bog error (see screenshots).
4) If you do not define the errorHandler (delete it from nuxt.config.js), it will log errors to console and not crash.

What is expected ?

Log errors to console and not crash.

What is actually happening?

Big error in console, not seemingly related to GQL or Apollo, and server crashes.
Screen Shot 2019-05-11 at 11.44.28 PM.png

Additional comments?

The same query in GraphiQL produces a nice error. See screenshot.
Screen Shot 2019-05-11 at 11.47.12 PM.png

750973092

750973092 posted a new question

apollo-module •

How can I dynamically set up Authorization in nuxt.config.js

How can I dynamically set up Authorization in nuxt. config. js, because I can use localStorage on the client side and asyncData requests on the server side?
1557576011(1).png

TomFranssen

TomFranssen posted a new question

apollo-module •

Bearer header not send

Hello!

I am trying to make a connection with my GraphQL server. This server needs a bearer token to authenticate. When I add this token to the config in the nuxt.config.js file it doesn't get send when the request happens. I get a 401 unauthorized when I try to send the request.

apollo: { tokenName: 'access_token', clientConfigs: { default: { httpEndpoint: 'https://api.commercetools.com/test/graphql/', getAuth: () => 'Bearer 268268286286286268' } } },

Any idea?

pi0

pi0 posted a new bug report

apollo-module •

bug Implicit dependency on `webpack-node-externals`

Version

v4.0.0-rc.4

Reproduction link

https://github.com/nuxt/now-builder/issues/31

Steps to reproduce

-

What is expected ?

-

What is actually happening?

now-builder uses a non-development distribution of nuxt, thus it does not need and does not installs webpack-node-externals.

Additional comments?

It can be advised to use apollo-module in devModules: [] (Because it is only needed for build/dev time to inject templates) or we add webpack-node-externals dependency to this package.

homerjam

homerjam posted a new bug report

apollo-module •

bug Prefetch not working?

Version

v4.0.0-rc.4

Reproduction link

https://codesandbox.io/embed/vny6o5o1j3

Steps to reproduce

Refresh the page and check the terminal/console

What is expected ?

The expected result is that the allCars data is available in the created() hook

What is actually happening?

The allCars data is undefined

merijnvanessen

merijnvanessen posted a new question

apollo-module •

GraphQL error: Invalid token.

Hello,

What happens, if I do a normal query I got an apollo error message with Invalid Token.
This happens because when I changed my cookie token 'auth' to value '123'

This should be possible for example when I change the JWT on my server.

When no cookie token is set, the query works perfect.
When the cookie token has the right jwt token value, the query works also perfect

For this query there is no auth needed, but still the Bearer token is sended in the header of the query?

How to avoid Bearer authorisations for normal queries ?

My query

async asyncData({ app, params, store }) {
    const response = await app.$graphql.query({
      query: GET_PAGE,
      variables: {
        slug: 'home'
      }
    })
    if (response.data.pages.length) {
      return {
        page: response.data.pages
      }
    }
  }

Schermafbeelding 2019-04-24 om 11.10.57.png