Skip to content

Include Apollo client-side #3650

Closed
Closed
@sedubois

Description

@sedubois

Description

I understand that Gatsby v2 will allow to have dynamic data client-side (e.g. to load user-specific data from some remote GraphQL API) which is great and I'm eagerly waiting for this. However as there's no ETA on v2 and I need to start with this now, I tried to integrate an Apollo GraphQL client myself (just querying a GraphQL API which has nothing to do with Gatsby) by rendering the component with the GraphQL query after componentDidMount has executed.

It works great in dev, but after building statically and opening the website I get this browser error:

screen shot 2018-01-22 at 16 29 15

There seems to be an error thrown at http://localhost:9000/component---src-layouts-en-js-851bbd767d539b6973bc.js:1:19724, but I have no idea how to know what it is, or why the error is not relayed properly.

Would you have any advice?

Environment

Gatsby version: 1.9.164
Node.js version: 9.4.0
Operating System: macOS High Sierra 10.13.2

File contents (if changed):

See #3582 (comment)

Actual result

Browser error, GraphQL component does not render.

Expected behavior

No browser error, GraphQL component shows query result which gets queried successfully in dev mode.

Steps to reproduce

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions