Skip to content

The request option "include" does not work in Parse.User.me() #1657

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
frouo opened this issue Jan 19, 2023 · 16 comments
Closed
4 tasks done

The request option "include" does not work in Parse.User.me() #1657

frouo opened this issue Jan 19, 2023 · 16 comments
Labels
bounty:$10 Bounty applies for fixing this issue (Parse Bounty Program) type:feature New feature or improvement of existing feature

Comments

@frouo
Copy link

frouo commented Jan 19, 2023

New Issue Checklist

Issue Description

await Parse.User.me(sessionToken, { include: "books" }) does not work.

The "include" key is actually ignored, books remains unfetched.

Steps to reproduce

Create a Parse.User with a column of type Pointer array, let's call it "books", add books.

Call const me = await Parse.User.me(sessionToken, { include: "books" })

Actual Outcome

me.get("books") returns an array of unfetched Book.

Expected Outcome

Would expect that book data is available.

Environment

Server

  • Parse Server version: 5.4.0
  • Operating system: macOS
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): local

Database

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

Client

  • Parse JS SDK version: 3.4.4

Fix idea:

static me(sessionToken: string, options?: RequestOptions = {}) {

  static me(sessionToken: string, options?: RequestOptions = {}) {
    const controller = CoreManager.getUserController();
    const meOptions: RequestOptions = {
      sessionToken: sessionToken,
    };
    if (options.useMasterKey) {
      meOptions.useMasterKey = options.useMasterKey;
    }
// FIX
    if (options.include) {
      meOptions.include = options.include;
    }
// end FIX
    const user = new this();
    return controller.me(user, meOptions);
  }
@parse-github-assistant
Copy link

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.

@mtrezza mtrezza added the type:feature New feature or improvement of existing feature label Jan 20, 2023
@rpfeil

This comment was marked as abuse.

@mtrezza
Copy link
Member

mtrezza commented Feb 1, 2025

Thank you @rpfeil for confirming this issue still exists. It seems it just didn't receive much attention. Does anyone want to open a PR with a failing test case, so we can fix this?

@mtrezza mtrezza added the bounty:$10 Bounty applies for fixing this issue (Parse Bounty Program) label Feb 1, 2025
@rpfeil

This comment was marked as abuse.

@rpfeil

This comment was marked as abuse.

@mtrezza
Copy link
Member

mtrezza commented Feb 4, 2025

You could open a PR, duplicate and modify one of these tests so that it executes the commands from the issue description with the me endpoint. Then we'll see whether it's replicable.

@rpfeil

This comment was marked as abuse.

@mtrezza
Copy link
Member

mtrezza commented Feb 6, 2025

There's a guide for first time contributors, see #1657 (comment). This is all integrated, it automatically launches a Parse Server and MongoDB instance when you run the test.

@rpfeil

This comment was marked as abuse.

@rpfeil

This comment was marked as abuse.

@rpfeil

This comment was marked as abuse.

@rpfeil

This comment was marked as abuse.

@rpfeil

This comment was marked as abuse.

@dplewis
Copy link
Member

dplewis commented Feb 7, 2025

@rpfeil For future reference the contribution guide can be found at the bottom of the ReadMe https://github.com/parse-community/Parse-SDK-JS?tab=readme-ov-file#contributing

I'll do a PR for this issue. I realized there could be refactoring with request options as well as a potential security issue.

For a workaround try

const user = await Parse.User.me(sessionToken);
await user.fetchWithInclude(...)

Please follow the Parse Community's Code of Conduct. We understand your frustration but harassment and spam will not be tolerated in the future.

@rpfeil

This comment was marked as abuse.

@dplewis
Copy link
Member

dplewis commented Feb 7, 2025

Closing as this is a server issue, duplicate parse-community/parse-server#8095

@dplewis dplewis closed this as completed Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bounty:$10 Bounty applies for fixing this issue (Parse Bounty Program) type:feature New feature or improvement of existing feature
Projects
None yet
Development

No branches or pull requests

4 participants