Comments (12)
we finally got everything working. had to do some work with changing the headers because of heroku. thanks for your help!
from next-with-apollo.
i'd be happy to link any other files or code snippets if they'll help also
from next-with-apollo.
Hi @holdeelocks , what's the result of this:
if (ctx.req && ctx.req.headers) {
console.log(ctx.req.headers, "request headers");
}
Does it have the headers that you need ?
Btw does it works when you run the project with next build && next start
? it may be related to a external thing changing the headers (like express)
from next-with-apollo.
The headers(cookies) we need aren't showing up in that console.log. We're using a custom server.js
file to do routing for our app. Our build commands are start: NODE_ENV=production node server.js
and heroku-postbuild: next build
. Could it be something to do with the custom express server or the way that we're starting it on heroku?
from next-with-apollo.
Here's a link to our frontend repo if that helps give you some context to what our code is like: https://github.com/up4life/frontend. It's a lot of code but the most relevant parts are in /utils/withData.js
/pages/index.js
server.js
and /pages/_app.js
from next-with-apollo.
@holdeelocks but does it work with a local build ? (the one generated with next build
), I may try to run your project later though
from next-with-apollo.
Yeah the cookies are in the request headers if I run next build && next start
or next build && node server.js
locally. Both commands work as expected.
from next-with-apollo.
@holdeelocks So the app works locally even with a build but fails in Heroku ?
from next-with-apollo.
Yeah exactly
from next-with-apollo.
@holdeelocks it looks like is related to Heroku then, have you tried looking in the docs for the changes they may be doing to the headers ? or anything related, another option is to not pass the headers object directly, but instead just send exactly what you need.
from next-with-apollo.
Yeah I've looked and according to their docs, they shouldn't be messing with our headers since we're using a custom domain. We've looked into other hosting solutions (mostly zeit) but we haven't been able to figure out a way to get our Apollo Server to deploy there.
from next-with-apollo.
Our main point of confusion is where in the process we might be able to intercept the request and keep heroku from removing the cookie header. We've also tried deploying our frontend on Zeit and still run into the same issue, so it's not solely a heroku issue. We have no clue what's causing this..
from next-with-apollo.
Related Issues (20)
- How to acces react context in HOC withApollo example? HOT 2
- Allow error handling on the server HOT 15
- Why prevent Apollo Client GraphQL errors from crashing SSR? HOT 1
- useQuery yields incorrect loading state during SSR HOT 1
- Missing meta data when upgrading from 4.3.0 to 5.0.1 HOT 2
- Still sending HTTP queries when getDataFromTree is not defined HOT 1
- When using @apollo/client it's not working HOT 1
- Cookie Disappearing after reload
- Testing getInitialProps when using ctx.apolloClient
- Option to use `getDataFromTree` also on client? HOT 3
- Are there any plans to upgrade this library to apollo/client 3.x ? HOT 6
- Query data null on server side HOT 1
- ctx is not added to props on the initial render HOT 2
- SSR is working on development but not working after build HOT 2
- Use getServerSideProps instead of getInitialProps HOT 7
- Support Next.js v11 HOT 1
- Type Error Using New Apollo HOT 2
- Update `5.3.0` broke router usage in _app.js HOT 3
- Detected multiple renderers concurrently rendering the same context provider HOT 6
- initialState is undefined despite passing getDataFromTree
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from next-with-apollo.