forcedotcom / quiz-host-app

Multiplayer quiz app built on Salesforce technology (host app)
Creative Commons Zero v1.0 Universal
108 stars 67 forks source link

Installation on Windows not working #88

Closed sandeepepita closed 3 years ago

sandeepepita commented 3 years ago

Hello I tried to install application as per steps given in https://github.com/fostive/quiz-host-app?ref=hackernoon.com it works well with "Managed Package" but its not working with Scratch Org (for development purposes) its giving error

Installing Quiz org:

Cleaning previous scratch org... Successfully marked scratch org quiz for deletion

Creating scratch org... WARNING: Warning: If you're using Contacts to Multiple Accounts, beginning with the Spring ’21 release, the feature isn't automatically enabled. You must manually enable the setting for new scratch orgs. Enable the setting in one of these ways: update the Account Settings page in Setup, add the enableRelateContactsToMultipleAccounts setting to your scratch org definition file, or enable it via Metadata API. Successfully created scratch org: 00D1j000000E4z8EAC, username: test-dhyglsiy5soa@example.com

Pushing source... Job ID | 0Af1j00001VJaKbCAL SOURCE PROGRESS | ████████████████████████████████████████ | 110/110 Components === Pushed Source STATE FULL NAME TYPE PROJECT PATH ───── ───────────────────────────────────────────────────── ────────────────────────── ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Add Quiz CustomApplication src\main\default\applications\Quiz.app-meta.xml Add QuizAbstractDataService ApexClass src\main\default\classes\QuizAbstractDataService.cls Add QuizAbstractDataService ApexClass src\main\default\classes\QuizAbstractDataService.cls-meta.xml Add QuizAnswer ApexClass src\main\default\classes\QuizAnswer.cls Add QuizAnswer ApexClass src\main\default\classes\QuizAnswer.cls-meta.xml Add QuizAnswerRestResource ApexClass src\main\default\classes\QuizAnswerRestResource.cls

||||||||||||||All apex class in between|||||||||||

Add QuizSettingsTest ApexClass src\test\default\classes\QuizSettingsTest.cls-meta.xml Add QuizTestUtils ApexClass src\test\default\classes\QuizTestUtils.cls Add QuizTestUtils ApexClass src\test\default\classes\QuizTestUtils.cls-meta.xml

Assigning permissions... === Failures Username Error Message ───────────────────────────── ─────────────────────────────────────────────────────────────────────── test-dhyglsiy5soa@example.com Permission set "Q" not found in target org. Do you need to push source?

Importing data... ERROR running force:data:tree:import: We couldn't process your request because you don't have access to Label__c on Quiz_Question__c. To learn more about field-level security, visit Tips and Hints for Page Layouts and Field-Level Security in our Developer Documentation. Installation failed.

Generating user password... Successfully set the password "xxxxxxxxxxxx" for user test-dhyglsiy5soa@example.com. You can see the password again by running "sfdx force:user:display -u test-dhyglsiy5soa@example.com".

Installation completed.

Access org 00D1j000000E4z8EAC as user test-dhyglsiy5soa@example.com with the following URL: https://customization-force-3605-dev-ed.cs102.my.salesforce.com/secur/frontdoor.jsp?sid=00D1j000000E4z8!ARkAQPjYJbIODmi5WJfPSBRsdWSvOXBLHPylUe98m.86cIK8N2meNMHmNP9HxE8SOgJZDoOvwcKn7jXWwHzzFxJ_hBKN5teQ&retURL=%2Flightning%2Fsetup%2FSecurityremoteProxy%2Fhome

Short summary of what is going on or to provide context. There is no App available in Apps image

To solve this problem I tried to add App so I given App permission to system admin from control panel But still getting this error image

Could you please help me in resolving this error and to make App run on Dev?

pozil commented 3 years ago

Hi @sandeepepita, thanks for your interest in the quiz app and for providing the logs along with your issue. Looking at those, I see that the error comes from the permission set assignment:

test-dhyglsiy5soa@example.com Permission set "Q" not found in target org. Do you need to push source?

What's strange is that the install script use Quiz_Host and not Q as the permission set name: https://github.com/fostive/quiz-host-app/blob/2829cadbfedd4e1ddf62b001db42ef57393f6cce/install-dev.bat#L37

Did you modify the install script?

sandeepepita commented 3 years ago

Hello @pozil Thank you for reply. No i didn't modify anything, I just followed given steps. I am kind of blocked at this stage. Also is it possible to install it directly on sandbox instead of scratch org? Could you please help me in proceeding further?

pozil commented 3 years ago

I recommend that you resume the installation on your scratch org by manually running the CLI commands that failed.

Open a terminal in the project quiz-host-app directory and run these these one at the time:

sfdx force:user:permset:assign -n Quiz_Host

sfdx force:data:tree:import -p data/sample/plan.json

sfdx force:org:open

BTW I noticed that your scratch org user password was visible in clear in the issue description so I edited your logs.

sandeepepita commented 3 years ago

Thank you @pozil for reply. Thanks for deleting password... I haven't noticed that while posting question. Regarding manual installation I already tried that and got similar error.

image

pozil commented 3 years ago

That is really strange. I wonder why the name of the permission set is cut on the first letter. Try to update your CLI maybe? Current version is around 7.118.x.

If that doesn't solve the issue, you can assign the permission set manually in your Org:

  1. go to Setup > Users > Permission Sets.
  2. click on Quiz Host then Manage Assignments
  3. add the permission set to your user

Once this is done you'll need to run the CLI command to deploy the sample data:

sfdx force:data:tree:import -p data/sample/plan.json
sandeepepita commented 3 years ago

I tried with the way you explained and imported sample data successfully but its not showing login form for players on heruku image

When I click on Reset button image

at that time form(registration form) for players appear for 1 second and disappear again.

pozil commented 3 years ago

Can your open your browser's developer console on both pages and check if there are errors?

sandeepepita commented 3 years ago

Yes image

And for Player on herokuapp

image

pozil commented 3 years ago

Looking at your logs, there's an error on the Heroku app. Can you expand the HTTP 500 error in the second screenshot and share your Heroku logs?

sandeepepita commented 3 years ago

OK here it is image

pozil commented 3 years ago

Sadly, there's no additional info in the browser console. Can you reproduce the error and extract the Heroku logs?

sandeepepita commented 3 years ago

Yes Logs from Heroku

Application Logs

2021-09-23T08:42:03.859581+00:00 app[web.1]: at HttpApi.getError (/app/node_modules/jsforce/lib/http-api.js:250:13) 2021-09-23T08:42:03.859582+00:00 app[web.1]: at /app/node_modules/jsforce/lib/http-api.js:95:22 2021-09-23T08:42:03.859582+00:00 app[web.1]: at tryCallOne (/app/node_modules/promise/lib/core.js:37:12) 2021-09-23T08:42:03.859583+00:00 app[web.1]: at /app/node_modules/promise/lib/core.js:123:15 2021-09-23T08:42:03.859583+00:00 app[web.1]: at flush (/app/node_modules/asap/raw.js:50:29) 2021-09-23T08:42:03.859583+00:00 app[web.1]: at processTicksAndRejections (node:internal/process/task_queues:78:11) { 2021-09-23T08:42:03.859584+00:00 app[web.1]: errorCode: 'INVALID_TYPE' 2021-09-23T08:42:03.859584+00:00 app[web.1]: } 2021-09-23T08:42:03.860629+00:00 heroku[router]: at=info method=GET path="/api/quiz-sessions" host=developerquizapp.herokuapp.com request_id=09bf2a1b-5569-4642-8f27-be46fae32aec fwd="163.5.55.50" dyno=web.1 connect=0ms service=194ms status=500 bytes=276 protocol=https 2021-09-23T08:42:11.833180+00:00 heroku[router]: at=info method=GET path="/" host=developerquizapp.herokuapp.com request_id=9d663e0a-8434-4835-96c1-5a4bd2f68e6e fwd="85.222.158.8" dyno=web.1 connect=0ms service=3ms status=200 bytes=881 protocol=https 2021-09-23T08:43:11.211025+00:00 heroku[router]: at=info method=PUT path="/api/quiz-sessions" host=developerquizapp.herokuapp.com request_id=28f5f962-3552-46fc-a201-cc68c235ca62 fwd="85.222.158.8" dyno=web.1 connect=0ms service=3ms status=200 bytes=201 protocol=https 2021-09-23T08:43:11.369495+00:00 heroku[router]: at=info method=GET path="/" host=developerquizapp.herokuapp.com request_id=ad9de23f-3739-40ae-ac05-877d12e8c294 fwd="163.5.55.50" dyno=web.1 connect=0ms service=13ms status=304 bytes=237 protocol=https 2021-09-23T08:43:11.208365+00:00 app[web.1]: WS broadcasting to 1 client(s): { type: 'phaseChangeEvent', data: { phase: 'Registration' } } 2021-09-23T08:43:11.404738+00:00 app[web.1]: WS connection closed 2021-09-23T08:43:11.371806+00:00 heroku[router]: at=info method=GET path="/api/configuration" host=developerquizapp.herokuapp.com request_id=759415c4-4af3-48aa-9cc0-f78b6626ada0 fwd="163.5.55.50" dyno=web.1 connect=0ms service=14ms status=200 bytes=241 protocol=https 2021-09-23T08:43:11.420396+00:00 heroku[router]: at=info method=GET path="/app-25ef211078057d75fbce.js" host=developerquizapp.herokuapp.com request_id=6d754bf2-505f-4489-8055-2f36aeb95b59 fwd="163.5.55.50" dyno=web.1 connect=0ms service=2ms status=304 bytes=239 protocol=https 2021-09-23T08:43:11.419832+00:00 heroku[router]: at=info method=GET path="/resources/dist/normalize.css" host=developerquizapp.herokuapp.com request_id=2ca2fc38-9ae1-439f-b038-3468a4588091 fwd="163.5.55.50" dyno=web.1 connect=0ms service=2ms status=304 bytes=238 protocol=https 2021-09-23T08:43:11.404266+00:00 heroku[router]: at=info method=GET path="/" host=developerquizapp.herokuapp.com request_id=7ec79b35-1ac7-4b33-a2a2-de1d77e06a24 fwd="163.5.55.50" dyno=web.1 connect=0ms service=67693ms status=101 bytes=226 protocol=https 2021-09-23T08:43:11.455038+00:00 heroku[router]: at=info method=GET path="/resources/logo.png" host=developerquizapp.herokuapp.com request_id=0b0c28fe-d6b1-40ca-8fb0-46c6ac9023d3 fwd="163.5.55.50" dyno=web.1 connect=0ms service=7ms status=304 bytes=238 protocol=https 2021-09-23T08:43:11.484183+00:00 app[web.1]: WS client connected 2021-09-23T08:43:11.633023+00:00 app[web.1]: getSession INVALID_TYPE: 2021-09-23T08:43:11.633025+00:00 app[web.1]: SELECT sfqzPhasec FROM sfqzQuiz_Sessionc 2021-09-23T08:43:11.633025+00:00 app[web.1]: ^ 2021-09-23T08:43:11.633025+00:00 app[web.1]: ERROR at Row:1:Column:28 2021-09-23T08:43:11.633026+00:00 app[web.1]: sObject type 'sfqzQuiz_Sessionc' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names. 2021-09-23T08:43:11.633027+00:00 app[web.1]: at HttpApi.getError (/app/node_modules/jsforce/lib/http-api.js:250:13) 2021-09-23T08:43:11.633027+00:00 app[web.1]: at /app/node_modules/jsforce/lib/http-api.js:95:22 2021-09-23T08:43:11.633027+00:00 app[web.1]: at tryCallOne (/app/node_modules/promise/lib/core.js:37:12) 2021-09-23T08:43:11.633028+00:00 app[web.1]: at /app/node_modules/promise/lib/core.js:123:15 2021-09-23T08:43:11.633028+00:00 app[web.1]: at flush (/app/node_modules/asap/raw.js:50:29) 2021-09-23T08:43:11.633028+00:00 app[web.1]: at processTicksAndRejections (node:internal/process/task_queues:78:11) { 2021-09-23T08:43:11.633029+00:00 app[web.1]: errorCode: 'INVALID_TYPE' 2021-09-23T08:43:11.633029+00:00 app[web.1]: } 2021-09-23T08:43:11.505076+00:00 heroku[router]: at=info method=GET path="/resources/favicon.ico" host=developerquizapp.herokuapp.com request_id=ab01b16c-3233-49bb-953d-5b10297342db fwd="163.5.55.50" dyno=web.1 connect=0ms service=1ms status=304 bytes=237 protocol=https 2021-09-23T08:43:11.634406+00:00 heroku[router]: at=info method=GET path="/api/quiz-sessions" host=developerquizapp.herokuapp.com request_id=fa564583-8840-48be-8afb-05ba3a6d670a fwd="163.5.55.50" dyno=web.1 connect=0ms service=188ms status=500 bytes=276 protocol=https

pozil commented 3 years ago

Hi @sandeepepita, thanks for the logs, this is the error that's causing your issue:

2021-09-23T08:43:11.633026+00:00 app[web.1]: sObject type 'sfqz__Quiz_Session__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.

You forgot to change the value of the SF_NAMESPACE Heroku environment variable (install step 2.4) and the player app is trying to access the Salesforce org object with the sfqz namespace prefix (that's the expected behavior for an installation with the Salesforce package). In your case, you're using a scratch org installation so you need to disable the namespace by changing the value of the SF_NAMESPACE variable to an empty string. Once you have done that, restart the Heroku Dyno and things should be back to normal.

sandeepepita commented 3 years ago

Hello @pozil, Thanks a looooot... :) finally its working...

pozil commented 3 years ago

Nice, I'm glad that we figured it out. Thanks for using the quiz app.