Skip to content

Object.save() and Query.first() issues #1601

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

Closed
4 tasks done
Kutikov opened this issue Nov 7, 2022 · 13 comments · Fixed by #1600
Closed
4 tasks done

Object.save() and Query.first() issues #1601

Kutikov opened this issue Nov 7, 2022 · 13 comments · Fixed by #1600
Labels
state:released Released as stable version state:released-alpha Released as alpha version state:released-beta Released as beta version type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@Kutikov
Copy link

Kutikov commented Nov 7, 2022

New Issue Checklist

Issue Description

I have a problem with saving and getting first object using Parse.Query in JS. The most strange thing is that in other my projects this code works seamlessly. I think that they are connected to each other, so I report about both of them in one time

  • await Parse.Query.first() is resulting in exception, while (await Parse.Query.find())[0] works correctly
  • Parse.Object.save() is resulting in undefined, not in issue

Steps to reproduce

Code to reproduce the new Parse.Query.first() problem:

const record = Parse.Object.extend('SyncVisitRecord'); //my class name string
const query = new Parse.Query(record);
query.equalTo("key", key);
const record1: Parse.Object = await query.first();

Code to reproduce the new Parse.Object.save() problem:

const record = Parse.Object.extend('SyncVisitRecord'); //my class name string
const query = new Parse.Query(record);
query.equalTo("key", key);
const record1: Parse.Object = await (await query.find())[0];
record1.set('lang', "us");
        record1.save()
            .then((gameScore) => {
                console.log(gameScore)
            }, (error) => {
                console.log(error)
            })

Actual Outcome

  • new Parse.Query.first() problem outcome is TypeError: Cannot read properties of undefined (reading 'className') at eval (parse.js:18430:39)
  • Parse.Object.save() problem outcome is undefined

Expected Outcome

  • I wait for regular Parse.Object
  • I wait for the saved object in db and regular Parse.Object in console

Environment

Server

  • Parse Server version: ^5.2.1
  • Operating system: Ubuntu 22.04.1 LTS
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Oracle Cloud

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: ^5.0.9
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): Local

Client

  • Parse JS SDK version: ^3.5.0

Logs

@parse-github-assistant
Copy link

parse-github-assistant bot commented Nov 7, 2022

Thanks for opening this issue!

  • 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

@Kutikov Kutikov closed this as not planned Won't fix, can't repro, duplicate, stale Nov 7, 2022
@Kutikov
Copy link
Author

Kutikov commented Nov 7, 2022

Sorry wrong repo

@mtrezza mtrezza transferred this issue from parse-community/parse-server Nov 7, 2022
@mtrezza mtrezza added the type:bug Impaired feature or lacking behavior that is likely assumed label Nov 7, 2022
@mtrezza mtrezza reopened this Nov 7, 2022
@mtrezza
Copy link
Member

mtrezza commented Nov 7, 2022

Closed via #1600

@mtrezza
Copy link
Member

mtrezza commented Nov 7, 2022

🎉 This change has been released in version 3.5.1-alpha.2

@mtrezza
Copy link
Member

mtrezza commented Nov 7, 2022

This should be fixed with https://github.com/parse-community/Parse-SDK-JS/releases/tag/3.5.1-alpha.2, could you try it out and let us know?

@Kutikov
Copy link
Author

Kutikov commented Nov 7, 2022

No luck! I've updated it, but no result. Same problems. Can it be any dependencies conflict?
The problem also occurred with 3.4.2. But in another project 3.4.2 faces no problem.

I have a suggestion: maybe some babel-related issues can cause my problem. I've reviewed the last commits and realised that most bugs in 3.5.0 were produced by wrong babel config

@mtrezza mtrezza reopened this Nov 7, 2022
@mtrezza
Copy link
Member

mtrezza commented Nov 7, 2022

The problem also occurred with 3.4.2. But in another project 3.4.2 faces no problem.

With the same Parse Server version? It may be related to your custom code and we'd need a failing test case to show that it's an issue with the Parse JS SDK. Could you open a PR with a test that demos the issue? Also you may want to make sure that you are really using 3.4.2 in both projects and maybe reinstall the SDK.

@dblythy
Copy link
Member

dblythy commented Nov 8, 2022

Are you using the sdk via NodeJS or in the browser via a CDN? If CDN, could you share the CDN link?

@Kutikov
Copy link
Author

Kutikov commented Nov 8, 2022

Same Parse server version, btw for of 3 my projects I have only one VDS in Oracle Cloud, so version of Parse server is always the same. I use NodeJS, no CDNs. Only Webpack 5.74.0 and Node 18.
About tests and demo... Maybe I've not enough experience for demo and auto tests. Would you like me to show Webpack config, packages.json and index.ts (issue can be investigated from index.ts on a few lines). Or I can open whole project in github for @mtrezza or anyone else to review code.
P.S. Sorry for bad english and slow commenting, I'm from Ukraine, we have some problems with electricity.

@dblythy
Copy link
Member

dblythy commented Nov 8, 2022

Got it - #1600 was related to browser environments so I'm not convinced this bug is fixed by that. Although #1600 was introduced in 3.4.4 (this version the build files were refactored significantly due to a regeneration node modules) and you've stated that the bug was occurring in 3.4.2. We don't actually have full Node 18 support yet (see #1597), but the build seems to be passing (see #1598).

The issue could be relating to webpack / typescript, if you could make a quick index.ts file with the problematic code, and then a package.json script to compile it, I could have a look at it.

P.S. Sorry for bad english and slow commenting

No worries, stay safe!

@Kutikov
Copy link
Author

Kutikov commented Nov 8, 2022

Sorry everybody! I figure out what is happening! NPM in Ukraine have strange cache error, so when i install ^3.5.1-alpha.2 it installs ^3.5.1-alpha.1. Of course no issues were fixed. So I manualy reinstall all dependencies and all seems to be ok!
Thanks for everybody. 3.5.1-alpha.2 fixes save() and first() !

@Kutikov Kutikov closed this as completed Nov 8, 2022
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 3.5.1-beta.2

@parseplatformorg parseplatformorg added the state:released-beta Released as beta version label Nov 26, 2022
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 3.5.1

@parseplatformorg parseplatformorg added the state:released Released as stable version label Nov 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:released Released as stable version state:released-alpha Released as alpha version state:released-beta Released as beta version type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants