Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BadRequestError when upload file with cookies #16

Open
JMoldes opened this issue Jul 24, 2019 · 0 comments
Open

BadRequestError when upload file with cookies #16

JMoldes opened this issue Jul 24, 2019 · 0 comments
Assignees
Labels

Comments

@JMoldes
Copy link

JMoldes commented Jul 24, 2019

When I use apollo-upload-client with express and redis with cookie session, I can't upload files.

If I disabled connect-redis-sessions, then I can upload file, it seems that middleware will change something that affects graphql-upload

The message error is:

BadRequestError: Missing multipart field ‘operations’ (https://github.com/jaydenseric/graphql-multipart-request-spec).

I have created a fork of the example project to simulate the problem, you can see it in:

https://github.com/JMoldes/apollo-upload-examples/tree/error-with-express-redis

The changes that I have made are:

  • Install the modules express, apollo-server-express, connect-redis-sessions and cookie-parser
  • Modify server.mjs to use express, and use the middleware connect-redis-sessions, and create a test session when upload the first file
  • Modify _app.js for add credentials: 'include' to createUploadlink

When I execute `npm run dev' for api and app, (previously I have to install redis ...), the first file I upload is ok, because I have not sent any cookies yet,

But after the first file is sent, te api sent a cookie to client, and when I upload the sencod file the Api show the next message:

BadRequestError: Missing multipart field ‘operations’ (https://github.com/jaydenseric/graphql-multipart-request-spec).

If I comment the line 22: app.use(fnCRS) the file upload ok.

image

If I inspect the outgoing network request body, operations is present.

image

The server works fine for all other cases in my app.

Why can not I upload files with express and redis using session cookies ?

the version of the apollo-server-express is 2.7.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants