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

Trouble progressing through experiment #112

Closed
Tracked by #107
JamesPHoughton opened this issue Jun 8, 2022 · 10 comments
Closed
Tracked by #107

Trouble progressing through experiment #112

JamesPHoughton opened this issue Jun 8, 2022 · 10 comments

Comments

@JamesPHoughton
Copy link
Contributor

JamesPHoughton commented Jun 8, 2022

Hi Nicolas, when we try to advance from one page in the intro screens to the next (it seems to be when next() is called) we're getting this error:

image

and the page fails to advance to the next intro screen. There are no console log messages that occur when the button is clicked, but we are getting this error in the console every few seconds after the server starts:

TypeError [ERR_INVALID_URL]: Invalid URL
empirica_1   |     at __node_internal_captureLargerStackTrace (node:internal/errors:456:5)
empirica_1   |     at __node_internal_addCodeToName (node:internal/errors:191:9)
empirica_1   |     at new NodeError (node:internal/errors:363:5)
empirica_1   |     at onParseError (node:internal/url:536:9)
empirica_1   |     at new URL (node:internal/url:612:5)
empirica_1   |     at getPackageScopeConfig (node:internal/modules/esm/resolve:177:24)
empirica_1   |     at packageResolve (node:internal/modules/esm/resolve:671:25)
empirica_1   |     at moduleResolve (node:internal/modules/esm/resolve:753:18)
empirica_1   |     at Loader.defaultResolve [as _resolve] (node:internal/modules/esm/resolve:867:11)
empirica_1   |     at Loader.resolve (node:internal/modules/esm/loader:89:40)
empirica_1   |     at ModuleJob._instantiate (node:internal/modules/esm/module_job:137:31)
empirica_1   |     at async ModuleJob.run (node:internal/modules/esm/module_job:171:5)
empirica_1   |     at async Loader.import (node:internal/modules/esm/loader:178:24)
empirica_1   |     at async Object.loadESM (node:internal/process/esm_loader:68:5)
empirica_1   |     at async handleMainPromise (node:internal/modules/run_main:63:12) {
empirica_1   |   input: './package.json',
empirica_1   |   code: 'ERR_INVALID_URL'
empirica_1   |  }

Google suggests that it might be related to a missing export: nodejs/node#38790, although I don't have a lot of confidence in that diagnosis.

Steps to reproduce

Our cypress tests aren't working properly in CI just yet (that's another issue) so I think you'll need to run the test locally to see it fail at this particular spot, or step through manually.

We aren't having the error in the other branches - Could it be something we're doing when we replace the consent and playerID pages?

@JamesPHoughton
Copy link
Contributor Author

The other branches are also on "@empirica/player": "^1.0.0-beta.2",

@JamesPHoughton
Copy link
Contributor Author

On further exploration, the TypeError [ERR_INVALID_URL]: Invalid URL seems to be associated with the switch to "@empirica/player(+ server)@^1.0.0-beta.3" - when I upgrade the main branch I get this message, although don't get the intro screen advance issue.

@JamesPHoughton
Copy link
Contributor Author

JamesPHoughton commented Jun 8, 2022

Managed to get all the way through intro screens, but can't launch a game. Can create batches, etc, but then everything waits at "No experiments available", in both cypress and manually

@JamesPHoughton JamesPHoughton changed the title Intro steps fail to advance Trouble progressing through experiment Jun 8, 2022
@JamesPHoughton
Copy link
Contributor Author

@npaton, @kepstein23,

This has turned into a bit of a stochastic bug, unfortunately. There definitely seems to be some issue with displaying the correct screens at the correct times. Everything is in this branch: https://github.com/Watts-Lab/deliberation-empirica/tree/james-simplify-tests

Phantom batches

Here (https://github.com/Watts-Lab/deliberation-empirica/blob/james-simplify-tests/cypress/e2e/No_Experiments_Available.js) is a test that checks that the "No experiments available" page displays when any existing batches have been completed. When I run it locally (recording on cypress.io here: https://dashboard.cypress.io/projects/htzagd/runs/60/overview/81d6bff1-9469-40a9-b8ea-b1e199e3e23b) it instead displays our consent form. What is interesting is that it initially does display the "No experiments available" before it does so, and then goes on to the consent form.

When the same test is run through GitHub actions it seems to give the correct behavior. https://dashboard.cypress.io/projects/htzagd/runs/62/test-results/5c5a7b68-ce10-4f9c-bbe9-bf2136f46b0d

Game doesn't start

This test (https://github.com/Watts-Lab/deliberation-empirica/blob/james-simplify-tests/cypress/e2e/Normal_Paths.js) should walk a single player through a 1 player game. When I run it locally (recording here: https://dashboard.cypress.io/projects/htzagd/runs/60/overview/e36196c2-f7a5-4ce2-b6fd-fca93e0ade67) It goes successfully through the intro screens, but then waits indefinitely at "Game Loading". If we add extra players, e.g. by making playerKeys longer at the top of the test file (the test will walk through all of them in stages):

    const playerKeys = [
        'test_'+Math.floor(Math.random() * 1e13),
        'test_'+Math.floor(Math.random() * 1e13)
    ]

the behavior is the same.

No informed consent on GH runner

When we run the above test as a Github action, (recording: https://dashboard.cypress.io/projects/htzagd/runs/61/test-results/ad899927-00b1-4f0d-b90c-8fe33c732bc7) the test fails earlier: https://dashboard.cypress.io/projects/htzagd/runs/62/test-results/d9b47ce8-bdd1-4759-aa1c-f114f6fdc3c8, with no experiments available! I'm fairly sure these are running sequentially (https://github.com/Watts-Lab/deliberation-empirica/runs/6821195224?check_suite_focus=true#step:3:304) so I don't think this is due to interference.

@npaton
Copy link
Contributor

npaton commented Jun 14, 2022

I apologize, I had not seen this bug(s) report before. I will do my best to fix it/them in the next couple of days.

@npaton
Copy link
Contributor

npaton commented Jun 16, 2022

I think there's a lot of things breaking due to the fact the js server component is probably not starting correctly.

I have been overoptimistic with Node.js' ESM support. Try to change the "scripts" in server/package.json to:

  "scripts": {
    "dev": "npm run build && node --trace-warnings --enable-source-maps dist/index.js",
    "build": "rsync -aP --exclude=node_modules --exclude=*.js -m src/* dist/ && esbuild src/index.js --platform=node --define:process.env.NODE_ENV='\"production\"' --bundle --minify --outfile=dist/index.js",
    "serve": "node --trace-warnings --enable-source-maps index.js"
  },

Also pull the latest version of Empirica itself (curl https://get.empirica.dev | sh).

And run:

empirica upgrade

Let me know how it goes.

@npaton
Copy link
Contributor

npaton commented Jun 16, 2022

Latest build still in progress, will be ready in ~10min.

@JamesPHoughton
Copy link
Contributor Author

The latest build (client: "@empirica/player": "^1.0.0-beta.3", server: "@empirica/admin": "^1.0.0-beta.4") fixes the walkthrough problems.

There is still the issue of phantom batches, ie. that the consent form and intro screens are available when there are no games available, tested here: https://dashboard.cypress.io/projects/htzagd/runs/180/overview/72bd8d5c-b4b2-4fc2-992e-a15af5499005

@npaton do you want me to move the remaining error to a separate issue and close this one?

@npaton
Copy link
Contributor

npaton commented Jun 25, 2022

Yeah, that would be great, thanks!

@JamesPHoughton
Copy link
Contributor Author

Moving the remaining error to issue #120

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