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

Parse sandbox doesn't seem to work #26

Closed
ntraut opened this issue Jan 15, 2021 · 7 comments
Closed

Parse sandbox doesn't seem to work #26

ntraut opened this issue Jan 15, 2021 · 7 comments

Comments

@ntraut
Copy link
Member

ntraut commented Jan 15, 2021

When trying to connect to Parse sandbox with

APP_ID='bbuond-foo'
APP_TOKEN='fa538a3f-a528-4a5f-9028-ecd789bac47c'
API_URL='http://127.0.0.1:1338/parse-sandbox'
curl --request GET \
  --url $API_URL'/login?password='$APP_TOKEN'&username='$APP_ID'&=' \
  --header 'x-parse-application-id: connect' \
  --header 'x-parse-revocable-session: 1'

I get the response {"error":"unauthorized"}. Not sure the Parse sandbox has already been working since there is no test for it.
@r03ert0: Is it supposed to work the same way as the main Parse api? What should we do with this?

@r03ert0
Copy link
Member

r03ert0 commented Jan 15, 2021

Yes, it's supposed to work the same as the prod one, with the difference that data should go away after some time. I have never tried to use it, but it was part of the specs.

@ntraut
Copy link
Member Author

ntraut commented Jan 15, 2021

OK, I think they did not finish this part. Not sure how to do to make data go away after some time, but we could at least try to make it work the same way as the main Parse api.

@r03ert0
Copy link
Member

r03ert0 commented Jan 15, 2021

ah... it should be finished. It was part of the contract. There's no info about it in the doc?

@ntraut
Copy link
Member Author

ntraut commented Jan 15, 2021

Ah yes, I didn't see that I needed also to change the x-parse-application-id to connect-sandbox. Now it seems to work...

@r03ert0
Copy link
Member

r03ert0 commented Jan 15, 2021

cool! close the issue if you think it's solved :)

@ntraut
Copy link
Member Author

ntraut commented Jan 23, 2021

I checked further and I was able to get a session id but after I wasn't able to interact with the API. It seems the cloud code is not correctly registered.
With the standard parse api:

APP_ID='bbuond-foo'
APP_TOKEN='e48040d3-77f8-4e5e-87cf-30da0bb065c0'
API_URL='http://127.0.0.1:1337/parse'
PARSE_APPLICATION='connect'

curl --request GET \
  --url $API_URL'/login?password='$APP_TOKEN'&username='$APP_ID'&=' \
  --header 'x-parse-application-id: '$PARSE_APPLICATION \
  --header 'x-parse-revocable-session: 1' > session.json

SESSION_TOKEN=$(jq -r '.sessionToken' < session.json)

curl --request GET \
  --url $API_URL'/classes/GameScore' \
  --header 'content-type: application/json' \
  --header 'x-parse-application-id: '$PARSE_APPLICATION \
  --header 'x-parse-session-token: '$SESSION_TOKEN | jq

I get:

{
  "results": [
    {
      "objectId": "4O3YBFuboG",
      "score": 44,
      "createdAt": "2021-01-12T09:20:35.072Z",
      "updatedAt": "2021-01-12T09:20:35.072Z",
      "ACL": {
        "role:Developer": {
          "read": true
        },
        "ZlfMsRneq6": {
          "write": true
        }
      }
    },
    {
      "objectId": "nw43VWxohI",
      "score": 44,
      "createdAt": "2021-01-12T09:24:52.949Z",
      "updatedAt": "2021-01-12T09:24:52.949Z",
      "ACL": {
        "role:Developer": {
          "read": true
        },
        "ZlfMsRneq6": {
          "write": true
        }
      }
    },
    {
      "objectId": "JDt74fYwS5",
      "score": 44,
      "createdAt": "2021-01-23T17:49:43.354Z",
      "updatedAt": "2021-01-23T17:49:43.354Z"
    }
  ]
}

But with the sandbox Parse API:

APP_ID='bbuond-foo'
APP_TOKEN='fa538a3f-a528-4a5f-9028-ecd789bac47c'
API_URL='http://127.0.0.1:1337/parse-sandbox'
PARSE_APPLICATION='connect-sandbox'

curl --request GET \
  --url $API_URL'/login?password='$APP_TOKEN'&username='$APP_ID'&=' \
  --header 'x-parse-application-id: '$PARSE_APPLICATION \
  --header 'x-parse-revocable-session: 1' > session.json

SESSION_TOKEN=$(jq -r '.sessionToken' < session.json)

curl --request GET \
  --url $API_URL'/classes/GameScore' \
  --header 'content-type: application/json' \
  --header 'x-parse-application-id: '$PARSE_APPLICATION \
  --header 'x-parse-session-token: '$SESSION_TOKEN

I get:

{"code":119,"error":"Permission denied for action find on class GameScore."}

Maybe I am still missing something but I rather think it is really not working...

@ntraut
Copy link
Member Author

ntraut commented Jan 25, 2021

The problem was that the way to register the cloud functions evolved for the tests but the sandbox API is not included in the tests so they forgot to make the update for the sandbox.

I would have liked to include the sandbox in the tests but it does not seem possible to run several Parse servers with cloud code on the same node instance (parse-community/parse-server#116). As the tests create their own connect server instance, for the moment I don't see a solution to run the sandbox in the tests...

@ntraut ntraut closed this as completed Mar 31, 2021
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

2 participants