WebDevStudios / nextjs-wordpress-starter

A headless starter for WordPress powered by Next.js.
https://webdevstudios.github.io/nextjs-wordpress-starter/
GNU General Public License v2.0
729 stars 125 forks source link

GravityForms File Upload error 500 #676

Open koraysels opened 2 years ago

koraysels commented 2 years ago

REPRODUCE:

When generating a form with gravityforms, add a file upload field and allow file formats like png and jpg image

BUG:

when you submit a form with a valid filetype that is the correct filesize, the form submission still fails with the following error:

VM24608:1 POST http://localhost:3000/api/wordpress/gravityForms 500 (Internal Server Error)

When we check out the network response the error message says: This file type is not permitted for security reasons

EDIT:

So the error occurs when next.js tries to execute the query in insertGfFormEntry.js L45

gregrickaby commented 2 years ago

@koraysels Thank you for reporting the issue.

@ravewebdev I'm unable to reproduce the issue above on my local. I am able to reproduce on WPE Dev though.

https://nextjs-wordpress-starter-develop.vercel.app/contact screenshot

I also found something that may be related? I'm unable preview the block itself: screenshot

There appears to be a JS error coming from the wds-headless-blocks plugin's JS file. If I deactivate the plugin, I can preview Gravity Forms in the block editor again.

koraysels commented 2 years ago

Actually I don’t use it in a block I just get the form by id and render it in the footer..

Sorry for being brief, sent from my iPhone

On 21 Sep 2021, at 16:42, Greg Rickaby @.***> wrote:

 @koraysels Thank you for reporting the issue.

@ravewebdev I'm unable to reproduce the issue above on my local. I am able to reproduce on WPE Dev though.

https://nextjs-wordpress-starter-develop.vercel.app/contact

I also found something that may be related? I'm unable preview the block itself:

There appears to be a JS error coming from the wds-headless-blocks plugin's JS file. If I deactivate the plugin, I can preview Gravity Forms in the block editor again.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

koraysels commented 2 years ago

are you sure this PR fixes this.. I still have issues with file uploads. the prblemn is that the FileList disappears in the req.body in api/wordpress/gravityForms.js So by the time it gets to inserGfFormEntry.js the fieldvalue becomes

field_8: "[object FileList]"

EDIT: for single file upload it works... but not for multiple

ravewebdev commented 2 years ago

@koraysels that PR is currently in draft, it is not ready. We are still looking into the issue on our end as we're having issues with the WP GraphQL for Gravity Forms plugin versions.

Also the starter does not currently support the GF multiple file upload field.

justlevine commented 2 years ago

@ravewebdev feel free to reach out to me via the WPGraphQL slack or the wp-graphql-gravity-forms discussions for help sorting out whatever plugin versions you've been running into.

I know we've been making breaking changes left and right, but we're getting closer to a stable api.

dushakov92 commented 9 months ago

Has anyone was able to fix this issue? Seems like even single File Upload produces 500 error.

justlevine commented 9 months ago

@dushakov92 if you're using the latest versions of Gravity Forms or WPGraphQL for Gravity Forms, you'll likely need to roll back to an older version compatible with this starter.

dushakov92 commented 9 months ago

@justlevine sounds good. can you share version number i need to roll back to or the one that worked for you?

justlevine commented 9 months ago

@justlevine sounds good. can you share version number i need to roll back to or the one that worked for you?

Honestly I dont know. Pretty sure WPGraphQL for GF is locked on v0.4 (you'd need to check to the releases to see where support for new versions of GF ), but I don't use this starter myself. I would start with the versions listed in the [composer.json https://github.com/WebDevStudios/nextjs-wordpress-starter/blob/01aee9dc0aea6fce66fc6b8da7497bf6897f38f2/backend/composer.json#L36] and the versions of WP and GF that were around at that release, confirm your file uploads are working again, and then incrementally update stuff until it breaks again.