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

PostMessage validation failed 409 (Conflict) #38

Open
tofu00 opened this issue May 21, 2021 · 5 comments
Open

PostMessage validation failed 409 (Conflict) #38

tofu00 opened this issue May 21, 2021 · 5 comments

Comments

@tofu00
Copy link

tofu00 commented May 21, 2021

I just finished Pt 1 video. but somehow it didn't work.
I'm getting the 409 error whenever i click the submit after choosing the file.

409 error

PostMessage validation failed: selectedFile: Cast to string failed for value "{↵ name: 'abcd.PNG',↵ type: 'image/png',↵ size: '24 kB',↵ base64: 'data:image/png;base64,iVBOFXH6UHWZ4XkKeLlsdIh... =',↵ file: {}↵}" (type Object) at path "selectedFile"

@CTZxVULKAN
Copy link

CTZxVULKAN commented May 27, 2021

I am having the same issue. I even cloned the repo and ran the code stilll the same issue.
It worked on the video though.

@Aman-zishan
Copy link

Aman-zishan commented May 30, 2021

@biswasjishnu @tofu00 I just reached at this bug, the problem was while passing selectedFile from client side it was in object type , we mentioned it to be String in backend.

The solution is to get only the base64 field from frontend data and then POST the request. In order to do that you just have to change the onDone in Forms.js like this.

Screenshot (199)

@CTZxVULKAN
Copy link

@Aman-zishan Thanks i will try this out as soon as possible.

@techay-mihir
Copy link

@biswasjishnu @tofu00 I just reached at this bug, the problem was while passing selectedFile from client side it was in object type , we mentioned it to be String in backend.

The solution is to get only the base64 field from frontend data and then POST the request. In order to do that you just have to change the onDone in Forms.js like this.

Screenshot (199)

when i use this i got error like file not found what should i do now ?

@CTZxVULKAN
Copy link

CTZxVULKAN commented Jun 8, 2021

@techy-mit Could you please be more specific with the issue you are having.
Make sure SelectedFile is defined in your schema
Use this for reference ->

Code in formjs

    <div className={`${classes.root} ${classes.fileInput}`}>
      <FileBase
        type="file"
        multiple={false}
        onDone={(file) => setItemData({...itemData, itemScreenshot: file.base64})} />
    </div>

Code for the schema

import mongoose from 'mongoose';

const itemSchema = mongoose.Schema({
  itemScreenshot: String,
});

const ItemInfo = mongoose.model('ItemInfo', itemSchema);
export default ItemInfo;

Without specific details i cannot help more, you should cross check your actions, reducers, api and the proxy u made in package.json in the client side. The error should lie in one of these places.

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

No branches or pull requests

4 participants