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

maxFileSize not working #9347

Closed
jj-matos opened this issue Oct 2, 2024 · 10 comments · Fixed by #9348
Closed

maxFileSize not working #9347

jj-matos opened this issue Oct 2, 2024 · 10 comments · Fixed by #9348
Assignees
Labels
🐛 bug Unresolved bug

Comments

@jj-matos
Copy link

jj-matos commented Oct 2, 2024

I have set maxFileSize to 20GB.
image

Got this error on trying to upload a 1.5GB file
image

Seems the limit stays at 200MB.

Our expectation is to be able to set a higher upload limit. Specifically 20GB.

I also tried to set a lower limit of 20MB and upload a 30MB file to check if it was just an upper limit issue, but it allowed to upload the 30MB file. So it seems that maxFileSize is not working at all. No matter the value is set, the limit is always 200MB.

Keystone 6
node v18.19.0

Any workaround this issue?

@gautamsi
Copy link
Member

gautamsi commented Oct 2, 2024

is there a proxy in between? then you have to change this on proxy as well. if not, try this

  server: {
      maxFileSize: 100 * 1024 * 1024,
      extendExpressApp(app) {

        app.use(bodyParser.json({ limit: '20gb' }));
      },
    },

@dcousens
Copy link
Member

dcousens commented Oct 2, 2024

Fixed in #9348

@dcousens dcousens closed this as completed Oct 2, 2024
@dcousens dcousens added the 🐛 bug Unresolved bug label Oct 2, 2024
@dcousens dcousens self-assigned this Oct 2, 2024
@dcousens dcousens changed the title maxFileSize not working in Keystone 6 maxFileSize not working Oct 2, 2024
@jj-matos
Copy link
Author

Thanks for the feedback.
No proxy. It doesn't work either in the dev environment in my pc nor in production.
Tried your solution. Not working either.
I am not using any of the suggested storage. Either local nor S3.
I am running a script in a resolveInput hook.
Before it just gave an error reaching the 200MB and wouldn't upload.
I went into node_modules and commented out the error trigger:
node_modules/graphql-upload/processRequest.js - line 249
It downloaded the file, but still only up to 200MB.
Unfortunately, your solution didn't change anything.
Still the same.
Being so, I request to reopen this issue, since it is not solved.

@dcousens dcousens reopened this Oct 11, 2024
@jj-matos
Copy link
Author

jj-matos commented Oct 11, 2024

I was using keystone 6.1.0
Updated to 6.3.0 and also fields-document and auth to the latest versions.
Deleted node_modules, yarn.lock and yarn cash.
Installed everything.
Keystone installation failed with graphql version conflict.
Tried resolution to 15.9.0, failed with QUERY error.
Installation worked with 16.9.0.
However, maxFileSize continues not working.
Also retried the body parser solution. Didn't work.

@jj-matos
Copy link
Author

jj-matos commented Nov 5, 2024

Again, I believe this is not solved.
I looked into the patch code.
Changed node_modules core file default.ts and nothing changed.
Then changed this on node_modules/graphql-upload/processRequest.js:
fileSize: maxFileSize,
to this:
fileSize: 20000 * 1024 *1024,
and it solved.
Also searched from where maxFileSize value comes from in this file, and I couldn't find where.
That's maybe the foundation of how to solve the issue.

@dcousens
Copy link
Member

dcousens commented Nov 7, 2024

@jj-matos following https://github.com/keystonejs/keystone/releases/tag/2024-11-07, can you please verify this still isn't working for you?

@jj-matos
Copy link
Author

jj-matos commented Nov 11, 2024

Thanks for the update.
After I updated the packages, I deleted all node_modules, yarn.lock and yarn cache, and reinstalled yarn.
It started giving an error on the listviews pages:

"Uncaught TypeError: selectedFields.keys().some is not a function
ListTable keystone-6-core-___internal-do-not-use-will-break-in-patch-admin-ui-pages-ListPage.esm.js:1175"

And now, even when i revert to previews keystone versions the error keeps poping up.

Also the API Apollo Playground at '/api/graphql' became inaccessible:

"This operation has been blocked as a potential Cross-Site Request Forgery (CSRF). Please either specify a 'content-type' header (with a type that is not one of application/x-www-form-urlencoded, multipart/form-data, text/plain) or provide a non-empty value for one of the following headers: x-apollo-operation-name, apollo-require-preflight\n"

@dcousens
Copy link
Member

@jj-matos that sounds like the following #9393

@jj-matos
Copy link
Author

The strange is that even reverting to past KS versions it doesnt solve. I have to download an old yarn.lock from past commits.

@jj-matos
Copy link
Author

This error had a different origin. Nothing to do with the update. It was an environment issue:
"This operation has been blocked as a potential Cross-Site Request Forgery (CSRF). Please either specify a 'content-type' header (with a type that is not one of application/x-www-form-urlencoded, multipart/form-data, text/plain) or provide a non-empty value for one of the following headers: x-apollo-operation-name, apollo-require-preflight\n"

But the other one I believe it is coming from the update

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

Successfully merging a pull request may close this issue.

3 participants