parse-community / parse-server

Parse Server for Node.js / Express
https://parseplatform.org
Apache License 2.0
20.84k stars 4.77k forks source link

Parse Cloud Code Function won't allow Queries, or any object manipulation through cloud code. #7728

Open malcolm-dane opened 2 years ago

malcolm-dane commented 2 years ago

New Issue Checklist

Issue Description

Repeated errors in cloud code function using queries. Setting no user in the fields, using master key etc doesn't allow for queries,object manipulation etc. Throws error: Parse error: TypeError: Cannot read property 'protectedFields' of undefined {"code":1,"stack":"Error: TypeError: Cannot read property 'protectedFields' of undefined\n at /app/node_modules/parse-server/lib/Controllers/DatabaseController.js:1170:21\n at processTicksAndRejections (internal/process/task_queues.js:95:5)"}

Steps to reproduce

I had the latest Parse Server, dropped it down to a few months old, and still the bug was there. Create cloud function to Query an Object and return an array etc. Manually created mongoatlas entries and tried to query them via cloud function, these items had no permissions set. master key was set to be used, and user set to false.

Actual Outcome

I have gotten several errors similiar to this or like this one:

error: Parse error: TypeError: Cannot read property 'protectedFields' of undefined {"code":1,"stack":"Error: TypeError: Cannot read property 'protectedFields' of undefined\n at /app/node_modules/parse-server/lib/Controllers/DatabaseController.js:1170:21\n at processTicksAndRejections (internal/process/task_queues.js:95:5)"}

Expected Outcome

For it to atleast return something retrieved from the backend

Environment

Heroku 20 Parse Server 4.10.0 -> latest build. Updated Node, downgraded node etc. Didn't go too long ago in version numbers.

Server "parse": "3.4.0", "parse-server": "4.10.0"

Database

Client

Logs

error: Parse error: TypeError: Cannot read property 'protectedFields' of undefined {"code":1,"stack":"Error: TypeError: Cannot read property 'protectedFields' of undefined\n at /app/node_modules/parse-server/lib/Controllers/DatabaseController.js:1170:21\

parse-github-assistant[bot] commented 2 years ago

Thanks for opening this issue!

mtrezza commented 2 years ago

Under "Steps to reproduce" could you please provide a 1. 2. 3. instruction for others to reproduce the issue? And even better, if you could provide a PR with a failing test, it would be even easier to understand.

malcolm-dane commented 2 years ago

I'll do it this weekend. It seems specific to the REST API.

jonas-db commented 2 years ago

I'm experiencing the same error in my jasmine test suite on the latest beta where I start/stop the parse server for every test.. it seems something is not reset/set correctly when the server is reinitialized. The first test always works fine, other tests usually fail with following error. Running each test separate makes all tests pass so it is not a test problem.

[Debug] ParseError: TypeError: Cannot read property 'protectedFields' of undefined
    at /Users/abc/server/node_modules/parse-server/src/Controllers/DatabaseController.js:1337:27
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at Object.getAuthForSessionToken (/Users/abc/server/node_modules/parse-server/src/Auth.js:88:16) {
  code: 1
}

EDIT: adding delay of 5seconds after the parseServer.handleShutdown(); seems to make the tests pass in most cases..

Maybe this is related?: https://github.com/parse-community/parse-server/pull/7525

mtrezza commented 2 years ago

That's interesting, so these are flaky tests? We do have some flaky tests in Parse Server, but it's also not uncommon for all tests to pass. Or are you talking about your own custom tests?

Maybe this is related?: #7525

May well be, depending on the test.

malcolm-dane commented 2 years ago

It occurs for me in regular use. Specifically with cloud functions. I can't figure it out.

On Wed, Dec 22, 2021, 6:05 PM Manuel @.***> wrote:

That's interesting, so these are flaky tests? We do have some flaky tests in Parse Server, but it's also not uncommon for all tests to pass. Or are you talking about your own custom tests?

— Reply to this email directly, view it on GitHub https://github.com/parse-community/parse-server/issues/7728#issuecomment-999931557, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACXJOVU2X4I3IWVVSNWMTH3USJKUPANCNFSM5I42E4CA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

jonas-db commented 2 years ago

I did some further digging.. and these are some observations. What do you think @mtrezza? (and yes it's my own test suite, based on: https://github.com/parse-community/parse-server/issues/7527#issuecomment-907510353)

in my case the error comes from the fact that:

DatabaseController#filterSensitiveData returns undefined for const perms = schema.getClassLevelPermissions(className); where className is either _Session or _User

https://github.com/parse-community/parse-server/blob/191d80b6677f8ee6f6a0ccd3bde2bf6bb50f9a20/src/Controllers/DatabaseController.js#L136

Usually this function returns something alike (eg for the _user):

{
  find: { '*': true },
  count: { '*': true },
  get: { '*': true },
  create: { '*': true },
  update: { '*': true },
  delete: { '*': true },
  addField: { '*': true },
  protectedFields: { '*': [ 'email' ] }
}

but since it is now undefined, it triggers an error at the following line: https://github.com/parse-community/parse-server/blob/191d80b6677f8ee6f6a0ccd3bde2bf6bb50f9a20/src/Controllers/DatabaseController.js#L202

The condition should include && perms because otherwise perms.protectedFields will trigger an error because perms is undefined.

if (!(isUserClass && userId && object.objectId === userId)) {
    protectedFields && protectedFields.forEach(k => delete object[k]); // fields not requested by client (excluded),
    //but were needed to apply protecttedFields

    perms.protectedFields && perms.protectedFields.temporaryKeys && perms.protectedFields.temporaryKeys.forEach(k => delete object[k]);
  }

If I extend the condition as follows: if (!(isUserClass && userId && object.objectId === userId) && perms), then the test case fails with:

error: Invalid session token {"code":209,"stack":"Error: Invalid session token\n at Object.getAuthForSessionToken (/Users/jonas/git/judica/server/node_modules/parse-server/src/Auth.js:100:11)\n at processTicksAndRejections (internal/process/task_queues.js:97:5)"}

Although my user is created and logged in (they have an id + sessiontoken).. I believe this error is not representative (just like the original error) and the issue lies somewhere in the code path above..

const registration = await Parse.User.signUp(email, "test", attributes); // AS_MASTER
        console.log(">>>> registration")
        console.log(registration.id,registration.get('sessionToken'))
        expect(registration.get('sessionToken')).to.not.be.undefined
        expect(registration.id).to.not.be.undefined

        const user = await Parse.User.logIn(email, "test");
        console.log(">>>> user")
        console.log(user.id,user.get('sessionToken'))
        expect(user.get('sessionToken')).to.not.be.undefined
        expect(user.id).to.not.be.undefined

        return user

So the question remains why schema.getClassLevelPermissions(className); returns undefined in some cases.. and as it occurs randomly it seems like a timing issue...

The SchemaController.schemadata is the following when the error occurs:

SchemaData {
  __data: {},
  __protectedFields: { _User: { '*': [Array] } }
}

but otherwise it is:

SchemaData {
  __data: {
    _User: {
      fields: [Object],
      classLevelPermissions: [Object],
      indexes: [Object]
    }
  },
  __protectedFields: { _User: { '*': [Array] } }
}

I also figured that performInitialization is not implemented for the mongodb adapter, while it is for the postgres adapter (where it ensures some schema things...). Maybe it needs to return a promise that waits for the schemas to be inserted instead of the current Promise.resolve()? Although i'm not sure this is related but performInitialization is called by the ParseServer constructor. https://github.com/parse-community/parse-server/blob/191d80b6677f8ee6f6a0ccd3bde2bf6bb50f9a20/src/Adapters/Storage/Mongo/MongoStorageAdapter.js#L995

mtrezza commented 2 years ago

Are you only observing this issue in your tests, or in an actual app? The original description by @malcolm-dane did not mention any tests, and they mentioned "It occurs for me in regular use", so I assume it was not test related.

I want to exclude the possibility that this issue is only related to the test setup where a some things are mocked for testing.

jonas-db commented 2 years ago

In my case the tests, but it should not matter because I initialize the parse server just as I do in my real application, no mockups, no other options. The only difference is that in the test it is started sequentially multiple times and therefore things might be slower and the startcomplete callback doesn't seem to trigger correctly. So i still assume some feature might not be initialized even though the callback suggest it is.

Let me see if i can make a minimal example

jonas-db commented 2 years ago

I've been narrowing down the issue.. but I need to dig some more. Right now it seems to occur when I have an asyncParse.Cloud.afterSave registered. @malcolm-dane do you have such a trigger as well maybe?

malcolm-dane commented 2 years ago

Yes I do.I haven't tried to debug this yet, with your added notes but I think there is an issue with the returning of an async promise and await. I think the issue is that the async isn't actually async, and certain cloud code functions cause some type of a race condition where the cloud code that is triggered isn't registered to the get/post method that called it. If that makes sense.... I have to look at the notes in my code. There is something weird going on, and I'm not too sure exactly what is causing it.

On Fri, Dec 24, 2021 at 5:04 AM jonas-db @.***> wrote:

I've been narrowing down the issue.. but I need to dig some more. Right now it seems to occur when I have an asyncParse.Cloud.afterSave registered. @malcolm-dane https://github.com/malcolm-dane do you have such a trigger as well maybe?

— Reply to this email directly, view it on GitHub https://github.com/parse-community/parse-server/issues/7728#issuecomment-1000765934, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACXJOVROAN4EGEMCDBF3BOLUSRASXANCNFSM5I42E4CA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

malcolm-dane commented 2 years ago

Sorry that is the most technical I can get at 6 am here ;). It's something strange like what I just described. I eliminated improper set up of the server(*), and tried all known solutions. It isn't my database configuration and it isn't any unusual middleware. I can't get cloud code interaction with the mongo database to work no matter how I set it up, and the only possible thing I could think of is that the cloud code is being called in an out of order way causing it to throw that error.

On Fri, Dec 24, 2021 at 6:01 AM Malcolm Dane < @.***> wrote:

Yes I do.I haven't tried to debug this yet, with your added notes but I think there is an issue with the returning of an async promise and await. I think the issue is that the async isn't actually async, and certain cloud code functions cause some type of a race condition where the cloud code that is triggered isn't registered to the get/post method that called it. If that makes sense.... I have to look at the notes in my code. There is something weird going on, and I'm not too sure exactly what is causing it.

On Fri, Dec 24, 2021 at 5:04 AM jonas-db @.***> wrote:

I've been narrowing down the issue.. but I need to dig some more. Right now it seems to occur when I have an asyncParse.Cloud.afterSave registered. @malcolm-dane https://github.com/malcolm-dane do you have such a trigger as well maybe?

— Reply to this email directly, view it on GitHub https://github.com/parse-community/parse-server/issues/7728#issuecomment-1000765934, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACXJOVROAN4EGEMCDBF3BOLUSRASXANCNFSM5I42E4CA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

jonas-db commented 2 years ago

@malcolm-dane, no i don't have that dependency. But in my case it seems because of aftersave triggers triggering other ones; and maybe i'm not awaiting some async operations correctly.. Still trying to figure it out

EDIT: idk, it might also be that signup/login for different users on nodejs is not supported? i'm clueless

jonas-db commented 2 years ago

EDIT: @mtrezza I found it... the SchemaCache is globally! I needed to clear it before each start of a test with SchemaCache.clear();. This should be documented somewhere

mtrezza commented 2 years ago

Good detective work! That would also mean it (practically) only affects tests, no actual app deployments. Can everyone in this thread who had this issue confirm that?

malcolm-dane commented 2 years ago

Mine is happening in production, however it may be that I am not initializing correctly. I have a bastardized version of the standard old Heroku version. I haven't tried to troubleshoot this in depth, but I do think it is happening due to a race condition in the async functions.

malcolm-dane commented 2 years ago

Hey so i went back and hardset the test flag to a negative, ensuring test is false. Interestingly, it's doing something new. See below. I'll have to write some cloud function, this is a different error message than what I had before. I mean my server is serving pages correctly, it's just cloud functions..

2021-12-28T02:00:48.074440+00:00 heroku[router]: at=info method=POST path="/parse/classes/GameScore" host=hackback-apps-gmbh.herokuapp.com request_id=e00dc6c0-9931-44dc-ba03-ecc93f00c8ce fwd="3.215.181.193" dyno=web.1 connect=0ms service=9ms status=500 bytes=685 protocol=https

2021-12-28T02:00:48.073163+00:00 app[web.1]: error: Parse error: TypeError: Cannot read property 'protectedFields' of undefined {"code":1,"stack":"Error: TypeError: Cannot read property 'protectedFields' of undefined\n at /app/node_modules/parse-server/lib/Controllers/DatabaseController.js:1170:21\n at runMicrotasks ()\n at processTicksAndRejections (internal/process/task_queues.js:95:5)"}

2021-12-28T02:00:48.075490+00:00 app[web.1]: (node:22) UnhandledPromiseRejectionWarning: Error: [object Object]

2021-12-28T02:00:48.075493+00:00 app[web.1]: at handleError (/app/node_modules/parse-server/node_modules/parse/lib/node/RESTController.js:422:17)

2021-12-28T02:00:48.075493+00:00 app[web.1]: at runMicrotasks ()

2021-12-28T02:00:48.075494+00:00 app[web.1]: at processTicksAndRejections (internal/process/task_queues.js:95:5)

2021-12-28T02:00:48.075494+00:00 app[web.1]: (Use node --trace-warnings ... to show where the warning was created)

2021-12-28T02:00:48.075531+00:00 app[web.1]: (node:22) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 37)

2021-12-28T02:00:48.075548+00:00 app[web.1]: (node:22) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

malcolm-dane commented 2 years ago

I changed my config, and that allowed cloud code to run, albeit not correctly. From a Cloud Code Function it seems several features are broken in cloud code if you try and run an operation against the database without a user.

I need to pull the built code of this parse server from Heroku, to see the code referenced in the error codes.From the debugging I have done and searches I have done it seems that Querying the MongoAtlas DB from cloud, regardless of forcing the master key in the function, results in a variety of errors.

When attempted, the function gets rejected.

Reviewing the stock code in DatabaseController.js will help narrow down exactly what the problem is. I had planned to build this from source and run it locally and see if the issue persist or not.

The stock errors are misleading, the errors are thrown even when a catch is implemented. It seems as if query.find({userMasterKey=true}) doesn't do anything. I suspect that it is attempting to read fields in the Object in Atlas, that are not specified, or are presumed permission protected by default or possibly reading the fields either in tandem with the original query or as a first order operation. I think there is a race condition, one cloud function causes two posts in my log. Not sure exactly what to think....

However the functions now run, but not correctly and not when trying to access from the database.

It would be helpful if I could see someone else cloud functions....

jonas-db commented 2 years ago

@malcolm-dane The only advice I can give is to strip down your server configuration to a minimal example. Maybe strip down your GameScore triggers if you have any? Also are you using/loading/migrating schemas on startup? Try disabling that because when I add schemas to the startup config it doesn't work anymore (but that might be related to https://github.com/parse-community/parse-server/pull/7525, i need to investigate more).

malcolm-dane commented 2 years ago

@malcolm-dane The only advice I can give is to strip down your server configuration to a minimal example. Maybe strip down your GameScore triggers if you have any? Also are you using/loading/migrating schemas on startup? Try disabling that because when I add schemas to the startup config it doesn't work anymore (but that might be related to #7525, i need to investigate more).

Got it working. With out a schema defined, cloud code can not be triggered server side. It seems that on deployment it generates a schema of it's own, but I'm still not sure where the collision is because it shouldn't matter. I am not sure what is causing this on init, but maybe include in the documentation something like below. As StackExchange, Reddit, etc there is lots of misleading info.

### In case anyone lands on this in the future. Solution is below.

In order for database Operations to properly function in cloud code use the rest API to Post sample below. Enter in your Parse configuration info, and change the web route to the object you are needing to manipulate in the back-end. Once this schema and access information is saved, cloud functions manipulating the database Object will now work. If you have a Parse Object in your mongo DB named 'Students', to manipulate via cloud functions a schema delegating access will need to be posted for that Object. Query -> /parse/classes/Students

Requires

/schemas/Students

curl -X POST \
-H "X-Parse-Application-Id:YOURID" \
-H "X-Parse-MASTER-KEY:YOURKEY" \
-H "Content-Type: application/json" \
-d '{
"classLevelPermissions":
{
"find": {
  "*": true ,
  "*": true
 },
"get": {
  "*":true ,
  "*": true
},
"create": { "*": true  },
"update": { "*": true },
"delete": { "*": true }
}
}' \
https:// https://YOURPARSEAPP.com/parse/schemas/OBJECT_NAME

Errors: error: Parse error: TypeError: Cannot read property 'protectedFields' of undefined {"code":1,"stack":"Error: TypeError: Cannot read property 'protectedFields' of undefined\n at /app/node_modules/parse-server/lib/Controllers/DatabaseController.js:1170:21\n at runMicrotasks ()\n at processTicksAndRejections (internal/process/task_queues.js:95:5)"}

malcolm-dane commented 2 years ago

Good detective work! That would also mean it (practically) only affects tests, no actual app deployments. Can everyone in this thread who had this issue confirm that?

Can I submit a Parse Server generic version that works right out the box on Heroku to the main project? Parse is my favorite framework for rapid prototyping and I am sure others would love to be able to have a copy of this that works right out of the box in 2021. Let me know!

mtrezza commented 2 years ago

Can I submit a Parse Server generic version that works right out the box on Heroku to the main project?

Not sure I understand what the issue is that you discovered. Is it possible to reproduce this in a failing test or does this only relate to your custom environment?

malcolm-dane commented 2 years ago

Hello Happy New Years!

Years ago it was possible to 1 click load a Parse Server on Heroku with mLab and have everything up and running with no issues or major bugs. Since mLab shut down, the one click deployment on most sites have ceased. It took me like a week to launch it on Heroku(my preferred as a service), because The Parse Server Example was poorly configured. I noticed in SE and other communities lots of people running into the same issues. If you'd like I can send you a stock version of my Parse Server Example that will work right out of the box on Heroku, with no major trouble shooting required. I use parse for rapid prototyping, I love the platform.

On Sat, Jan 1, 2022 at 4:51 PM Manuel @.***> wrote:

Can I submit a Parse Server generic version that works right out the box on Heroku to the main project?

Not sure I understand what the issue is that you discovered. Is it possible to reproduce this in a failing test or does this only relate to your custom environment?

— Reply to this email directly, view it on GitHub https://github.com/parse-community/parse-server/issues/7728#issuecomment-1003623642, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACXJOVVQGMIKVIIMNS7QQKLUT5ZO3ANCNFSM5I42E4CA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

mtrezza commented 2 years ago

Thanks for clarifying, which changes / steps are needed to make it work on Heroku? Does this still relate to the issue you originally described here "Parse Cloud Code Function won't allow..."?

malcolm-dane commented 2 years ago

I'll send a summary of notes about the problems with deploying the parse Server example, and in a week or two I can link you a demo repo. I just need to set up the mailgun and every part of the framework will be working right out of the box on Heroku(Checked), and Amazon. It was hard enough to troubleshoot that one of my colleagues started using one of those providers that offer an environment specifically for Parse. We use it for rapid prototyping and demo proof of concepts for iot solutions , but I've had it in production before with no issues.

On Sat, Jan 1, 2022 at 5:08 PM Manuel @.***> wrote:

Thanks for clarifying, which changes / steps are needed to make it work on Heroku?

— Reply to this email directly, view it on GitHub https://github.com/parse-community/parse-server/issues/7728#issuecomment-1003626524, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACXJOVQ74XPJAVSS27RHWYLUT53MZANCNFSM5I42E4CA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

malcolm-dane commented 2 years ago

To be clear this is vanilla Parse, just preconfigured and optimized to run on Heroku with ease. There is no custom code, extensions etc.

On Sat, Jan 1, 2022 at 5:13 PM Malcolm Dane < @.***> wrote:

I'll send a summary of notes about the problems with deploying the parse Server example, and in a week or two I can link you a demo repo. I just need to set up the mailgun and every part of the framework will be working right out of the box on Heroku(Checked), and Amazon. It was hard enough to troubleshoot that one of my colleagues started using one of those providers that offer an environment specifically for Parse. We use it for rapid prototyping and demo proof of concepts for iot solutions , but I've had it in production before with no issues.

On Sat, Jan 1, 2022 at 5:08 PM Manuel @.***> wrote:

Thanks for clarifying, which changes / steps are needed to make it work on Heroku?

— Reply to this email directly, view it on GitHub https://github.com/parse-community/parse-server/issues/7728#issuecomment-1003626524, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACXJOVQ74XPJAVSS27RHWYLUT53MZANCNFSM5I42E4CA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

malcolm-dane commented 2 years ago

Hello I've been busy. I uploaded a ready to launch heroku version of the parse-server-example. https://github.com/malcolm-dane/backend

It needs to be cleaned some, with notes added and I plan to add a wiki to ease adoption. I have it serving custom paths, cloudcode, mailgun(not in this commit) and a bunch of other features. I included a js app that launches from the custom route demo https://hackback-apps-gmbh.herokuapp.com/demo/. Take a look. Repo is at https://github.com/malcolm-dane/backend

On Sat, Jan 1, 2022 at 5:08 PM Manuel @.***> wrote:

Thanks for clarifying, which changes / steps are needed to make it work on Heroku?

— Reply to this email directly, view it on GitHub https://github.com/parse-community/parse-server/issues/7728#issuecomment-1003626524, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACXJOVQ74XPJAVSS27RHWYLUT53MZANCNFSM5I42E4CA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

malcolm-dane commented 2 years ago

It needs a cleaning because it contains left over code from various experiments, but it works. It's more or less secure, builds and launches. I literally have it working as a block view explorer, I can't share that though, and it passed the pentester people at my work. It's nimble and perfect for quick deployment. Please be gentle in criticism, it represents tons of man hours from November.

On Sun, Jan 16, 2022 at 12:10 AM Malcolm Dane < @.***> wrote:

Hello I've been busy. I uploaded a ready to launch heroku version of the parse-server-example. https://github.com/malcolm-dane/backend

It needs to be cleaned some, with notes added and I plan to add a wiki to ease adoption. I have it serving custom paths, cloudcode, mailgun(not in this commit) and a bunch of other features. I included a js app that launches from the custom route demo https://hackback-apps-gmbh.herokuapp.com/demo/. Take a look. Repo is at https://github.com/malcolm-dane/backend

On Sat, Jan 1, 2022 at 5:08 PM Manuel @.***> wrote:

Thanks for clarifying, which changes / steps are needed to make it work on Heroku?

— Reply to this email directly, view it on GitHub https://github.com/parse-community/parse-server/issues/7728#issuecomment-1003626524, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACXJOVQ74XPJAVSS27RHWYLUT53MZANCNFSM5I42E4CA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

mtrezza commented 2 years ago

This seems to be a one-time commit so it's difficult to see what changed to make it work on Heroku. Do you think it's possible to propose the changes to the original parse-server-example repo in the form of a PR? Not sure whether it's mergeable but we could at least discuss. If mergeable, we could avoid having to maintain two separate repos (original and Heroku-compatible).

It seems this issue is originally about something else, so maybe you can open the PR and we can discuss there to not confuse readers of this thread.

malcolm-dane commented 2 years ago

SO you checked it out, the js demo and everything? Like I said it needs some cleaning up, and comments for documentation, it is littered with old experiment code while I was playing around with it. There seems to be issue reports on the main repo for parse-server-example requesting support for each popular platform. nodeJS is a bitch to debug.

What could work is a shell script to auto configure it for heroku deployment. I ran into problems with some of the unneeded middleware in the current example on heroku, which I haven't quite figured out the reasons for, but I assume due to middleware/Heroku incompatibility. I don't think much maintenance would be needed beyond adding the reset pages for passwords, the mailgun, etc and better documentation and updating it for QOL improvements as heroku adds new features. I don't expect radical adjustments will be needed long term,or require much support. The heroku platform isn't really changing anytime soon.They will continue to support ubuntu 20.04, 18.04.

I don't mind supporting it, or hosting the fork on my git, but I think it will be popular and used alot if it is on the main repo. I don't do lots of open source things, I just really like the ease of use that Parse provides and am a big fan of the framework.I also noticed lots of online forums asking for help with the same errors I encountered after the Mongodb to Atlas migration and the removal of one click deployment. So whatever you think is best.

On Sun, Jan 16, 2022 at 5:38 AM Manuel @.***> wrote:

This seems to be a one-time commit so it's difficult to see what changed to make it work on Heroku. Do you think it's possible to propose the changes to the original parse-server-example repo in the form of a PR to discuss? This could avoid having to maintain two separate repos (original and Heroku-compatible).

— Reply to this email directly, view it on GitHub https://github.com/parse-community/parse-server/issues/7728#issuecomment-1013850936, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACXJOVXGJJYGIAPAAI7SS63UWKN2VANCNFSM5I42E4CA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

mtrezza commented 2 years ago

As you already pointed out, I also think an addition / modification of the original parse-server-example repo would bring the most visibility and advantage for others. For the moment, I think a PR that shows the changes needed in the example repo would be a good start for discussion.

malcolm-dane commented 2 years ago

Sounds good. Sorry been busy with day job.

malcolm-dane commented 2 years ago

When doing the pull request, it's master to version that the request is made on right? Sorry, like I said I don't normally participate in open source projects generally.

mtrezza commented 2 years ago

You'd start a new branch off alpha branch in this repo, see https://github.com/parse-community/parse-server/issues/7639.