GithubHelp home page GithubHelp logo

Comments (27)

jsoendermann avatar jsoendermann commented on May 13, 2024

I get the same error.

from parse-server.

rebelchris avatar rebelchris commented on May 13, 2024

Subscribing: Same here
Edit: Using JS SDK

from parse-server.

 avatar commented on May 13, 2024

Same here with iOs SDK.

from parse-server.

gfosco avatar gfosco commented on May 13, 2024

Will take a look at this.

from parse-server.

hafizapp avatar hafizapp commented on May 13, 2024

[Error]: schema mismatch for _Session.createdWith; expected map but got object (Code: 111, Version: 1.12.0)
Yes same here for iOS app, any one have luck to get it working...

from parse-server.

hmoqhim avatar hmoqhim commented on May 13, 2024

Same thing here. iOS SDK

from parse-server.

poseidonsw avatar poseidonsw commented on May 13, 2024

I'm getting the same error using the JS SDK

I noticed in mongoDB in _Schema it is expecting a map when it should be an object. Must have happened in the migration tool. I changed it to object and got passed this problem. Now it seems to be complaining about expiresAt being a number when it expected a date.

Update: What worked for me in your migrated MongoDB in _SCHEMA:_session, change createdWith value to object and expiresAt value to string

then in parse-server/transform.js after line 44 ad a case for expiredAt to transform it to a iso date format for the database:

case 'expiresAt':
case '_expires_at':
  key = 'expiresAt';
  timeField = true;
  break;

finally in parse-server/users.js prior to line 58 I created an expireDate and added a year to it:

var expiresAt = new Date();
expiresAt.setFullYear(expiresAt.getFullYear() + 1);

finally line 70 I change:

expiresAt: 0,

to:

expiresAt: Parse._encode(expiresAt).iso,

from parse-server.

natanrolnik avatar natanrolnik commented on May 13, 2024

I've just deployed the parse server for my app in development, and when trying to login or create a new user account (iOS SDK), I'm getting the same error.

from parse-server.

gfosco avatar gfosco commented on May 13, 2024

Can you open the _SCHEMA collection in your mongo installation, and paste the value for the _Session object?

from parse-server.

poseidonsw avatar poseidonsw commented on May 13, 2024

@gfosco this was mine right out of the migrate tool before I made the changes I posted above.

{
"_id" : "_Session",
"_metadata" : {
    "class_permissions" : {
        "get" : {
            "*" : true
        },
        "find" : {
            "*" : true
        },
        "update" : {
            "*" : true
        },
        "create" : {
            "*" : true
        },
        "delete" : {
            "*" : true
        },
        "addField" : {
            "*" : true
        },
        "readUserFields" : [],
        "writeUserFields" : []
    }
},
"user" : "*_User",
"installationId" : "string",
"restricted" : "boolean",
"expiresAt" : "date",
"createdWith" : "map",
"sessionToken" : "string",
"updatedAt" : "string",
"createdAt" : "string",
"objectId" : "string"
}

from parse-server.

gfosco avatar gfosco commented on May 13, 2024

Merged #87 which should address all of this. Will tag a new release. 2.0.2

from parse-server.

h4rm avatar h4rm commented on May 13, 2024

Hi Fosco,
the recent changes have not solved the problem for me. Still getting schema mismatch for _Session.createdWith; expected map but got object as a response to a login. I have upgraded to 2.0.2 on my Heroku instance using the MongoLab MongoDB as described in the migration guide.
Other GET requests for example get through as expected though.

from parse-server.

natanrolnik avatar natanrolnik commented on May 13, 2024

@vection take a look at @poseidonsw first comment. There may be a bug in the migration tool, and in the _Session schema you need to change:

"createdWith": "object"

from a map to an object.
Also, I needed to change the expiresAt field from date to string in order for this to work.

from parse-server.

gfosco avatar gfosco commented on May 13, 2024

Caught that in #87 just now (should allow it to stay as "map" in the schema)... can you try the current master? This doesn't change anything with 'expiresAt', still need more info on the best way to fix that if still a problem.

from parse-server.

h4rm avatar h4rm commented on May 13, 2024

Yes, I already tested it with the current master (2.0.2).
Doing the changes to _SCHEMA:_session (change createdWith value to object and expiresAt value to string) worked however.

from parse-server.

poseidonsw avatar poseidonsw commented on May 13, 2024

@gfosco I can clean up my change for expiresAt and send it as a PR. It sets the expiresAt a year in advance similar to what parse.com api does. You do still need to change it in the _SCHEMA:_Session from date to string, but that would make it consistent with the other dates in the _SCHEMA collection

from parse-server.

jpv123 avatar jpv123 commented on May 13, 2024

I'm sorry, I don't understand. Was it solved on 2.0.2? I'm having also the same problem

from parse-server.

gfosco avatar gfosco commented on May 13, 2024

Should be in 2.0.3

On Saturday, January 30, 2016, jpv123 [email protected] wrote:

I'm sorry, I don't understand. Was it solved on 2.0.2? I'm having also the
same problem


Reply to this email directly or view it on GitHub
#32 (comment)
.

from parse-server.

hafizapp avatar hafizapp commented on May 13, 2024

Till now it's same thing, please fix ..

[Error]: schema mismatch for _Session.expiresAt; expected date but got string (Code: 111, Version: 1.12.0)

@gfosco

from parse-server.

natanrolnik avatar natanrolnik commented on May 13, 2024

@hafizapp to fix that, open your schema in your mongodb, and find the _Session object. There, you should change expiresAt from date to String.

from parse-server.

gfosco avatar gfosco commented on May 13, 2024

Yeah, that will fix it, but we do need to add something in parse-server to
handle this scenario cleanly without having to edit the schema.

On Sun, Jan 31, 2016 at 12:52 AM, Natan Rolnik [email protected]
wrote:

@hafizapp https://github.com/hafizapp to fix date, open your schema in
your mongodb, and find the _Session object. There, you should change
expiresAt from date to String.


Reply to this email directly or view it on GitHub
#32 (comment)
.

from parse-server.

 avatar commented on May 13, 2024

@gfosco should we wait for the fix or can we change the expiresAt from date to string now and continue the development from here ? I mean, if we change the mongodb schema, will we have some issues with the next updates of parse-server ?

from parse-server.

hafizapp avatar hafizapp commented on May 13, 2024

@natanrolnik Thanks, It fixed. but it would be more helpful if we get the answer of @fraxool question.

from parse-server.

natanrolnik avatar natanrolnik commented on May 13, 2024

@hafizapp definitely

from parse-server.

rebelchris avatar rebelchris commented on May 13, 2024

I did change to 2.0.3 and changed expiresAt from date to string

It seems to work, but the js sdk gives me the following error:
Uncaught Error: Tried to encode an unsaved file.

File parse-1.6.7.min.js:9164
I'm guessing it has something to do with this issue? since it was working before..

from parse-server.

joeyslack avatar joeyslack commented on May 13, 2024

I'm getting issues with expiredAt. Is it still valid for me to change my schema, to convert expiresAt from Date type (iso) to String?

from parse-server.

drew-gross avatar drew-gross commented on May 13, 2024

Sure, but I'd recommend you try that on a dev DB before doing it in your prod DB. Can you also open a new issue describing how you got into this situation? (Was this a migrated DB, or a new one? Does your app use revocable sessions? etc.)

from parse-server.

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.