Coder Social home page Coder Social logo

Comments (10)

todor0v avatar todor0v commented on September 27, 2024 1

I have the exact same issue on Payload 3.0.0-beta.43 and Sharp 0.33.4.

If I do not specify the height at all, I get:
ERROR: FileUploadError: There was a problem while uploading the file. at generateFileData (webpack-internal:///(rsc)/./node_modules/payload/dist/uploads/generateFileData.js:232:15)

If I specify the height as any number or undefined, I get:
ERROR: ValidationError: media validation failed: sizes.image.height: Cast to Number failed for value "NaN" (type number) at path "height" at Document.invalidate (/node_modules/mongoose/lib/document.js:3177:32)

For me the suggested maxOffsetY fix did not work.

from payload.

kirillminiaev avatar kirillminiaev commented on September 27, 2024 1

@kirillminiaev Of course: image

@todor0v your error seems to be related more to your database: MongoDB. It's as if the database model expects there to be a "height" value for your resizing and when a NaN value is passed, the internal Model validation kicks in and spews the error. So in your case, I would think either a height is required (and the Payload team needs to address a workaround) or code needs to ensure that a NaN is not passed to the model. Ultimately, it could be that whatever data is passed to the Next create.js:20:17 line needs to be pre-processed to validate the height parameter. At least that is where I would start my debugging process if I were you.

from payload.

denolfe avatar denolfe commented on September 27, 2024 1

Fairly certain this is the fix #6729

Let's verify in the next 2.x release.

from payload.

kirillminiaev avatar kirillminiaev commented on September 27, 2024

I have the exact same issue on Payload 3.0.0-beta.43 and Sharp 0.33.4.

If I do not specify the height at all, I get: ERROR: FileUploadError: There was a problem while uploading the file. at generateFileData (webpack-internal:///(rsc)/./node_modules/payload/dist/uploads/generateFileData.js:232:15)

If I specify the height as any number or undefined, I get: ERROR: ValidationError: media validation failed: sizes.image.height: Cast to Number failed for value "NaN" (type number) at path "height"

For me the suggested maxOffsetY fix did not work.

@todor0v can you post a full error stack-trace. Seems you may need to adjust the code pertaining to the specific Cast to Number failed for value "NaN" (type number) at path "height" error for a fix for your version of Payload.

from payload.

todor0v avatar todor0v commented on September 27, 2024

@kirillminiaev Of course:
image

from payload.

kirillminiaev avatar kirillminiaev commented on September 27, 2024

Fairly certain this is the fix #6729

Let's verify in the next 2.x release.

@denolfe thank you. Looking forward to the next release with the fix implemented.

from payload.

kirillminiaev avatar kirillminiaev commented on September 27, 2024

@PatrikKozak, just upgraded to 2.20.0 and the issues persists. Not sure if you were planning to push the fix with this next release. My original fix patched the issue in 2.20.0

from payload.

PatrikKozak avatar PatrikKozak commented on September 27, 2024

Hey @kirillminiaev

I have a fix for the issue here.

V3 fix is here

We'll get these merged either today or tomorrow!

from payload.

kirillminiaev avatar kirillminiaev commented on September 27, 2024

Thank you @PatrikKozak!

from payload.

github-actions avatar github-actions commented on September 27, 2024

This issue has been automatically locked.
Please open a new issue if this issue persists with any additional detail.

from payload.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.