rojo-rbx / run-in-roblox

Run a place, model, or individual script inside Roblox Studio, integrating with command line tools
MIT License
53 stars 22 forks source link

Error: "Timeout reached while waiting for Roblox Studio to come online" #21

Open grilme99 opened 3 years ago

grilme99 commented 3 years ago

When using run-in-roblox in a windows-latest GitHub Action I get the error Timeout reached while waiting for Roblox Studio to come online. This happens 100% of the time in the action but I am not able to reproduce it locally.

I am running run-in-roblox with a .rbxl file that is 17MB in size. The following is the relevent part of my workflow YML:

- name: Install Roblox Studio
  uses: OrbitalOwen/roblox-win-installer-action@1.0
  with:
      cookie: ${{ secrets.ROBLOSECURITY }}
      token: ${{ secrets.GITHUB_TOKEN }}
  timeout-minutes: 2

- name: Run unit tests with run-in-roblox
  run: npm test

The npm test command is run-in-roblox --place game.rbxl --script ci-scripts/unit-testing.lua.

LPGhatguy commented 3 years ago

Agh, these issues are a pain to diagnose; I'm sorry you ran into this.

In the past, the culprits of these issues were things like:

  1. The authentication cookie used in the installation is no longer valid. Testing it independently is a good idea if you haven't already.
  2. Something about the Roblox Studio Bootstrapper changed. Maybe it's stuck on something! Maybe they've finally changed the way that credentials are stored. 😅
LPGhatguy commented 3 years ago

Sounds like multiple people might be running into this. @jeparlefrancais or @OrbitalOwen, have either of you run into this before? Any ideas?

boatbomber commented 2 years ago

I'm encountering this issue as well, but flaky (unlike OP who has 100% failure).

thread '' panicked at 'called Result::unwrap() on an Err value: Timeout reached while waiting for Roblox Studio to come online', src/main.rs:75:9

Sometimes it hits this error, sometimes it doesn't. I just rerun the workflow and hope to get lucky (and use up all of my Actions minutes).

boatbomber commented 2 years ago

If it helps, my workflow is a bit different than most people's. I install studio, then open with a blank .lua file to finalize the installation (this flaky fails) and make Studio create directories, then edit those files to make fflag changes, then open my actual test file and script.

jobs:
  Curriculum:
    strategy:
      fail-fast: false
    runs-on: windows-latest
    timeout-minutes: 13
    steps:
      # Get dependencies
      - name: Checkout repository
        uses: actions/checkout@v1
        with:
          submodules: recursive

      - name: Studio installation
        uses: OrbitalOwen/roblox-win-installer-action@1.1
        with:
          cookie: ${{ secrets.ROBLOSECURITY }}
          token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

      - name: Foreman installation
        uses: rojo-rbx/setup-foreman@v1
        with:
          token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

        # Build .rbxlx file
      - name: Build test project
        run: rojo build default.project.json -o ./tests/test.rbxlx

        # Open Studio so it finalizes installation
      - name: Open Studio to finalize installation
        run: |
          New-Item ./noop.lua
          Set-Content ./noop.lua '--noop'
          run-in-roblox --place ./tests/test.rbxlx --script ./noop.lua

        # Edit fast flags
      - name: Edit FFlags
        run: |
          $flags = Get-Content -Path C:/Users/*/AppData/Local/Roblox/ClientSettings/StudioAppSettings.json -Raw | ConvertFrom-Json
          $flags.AnyCustomFlagsHere=$true
          New-Item -Path 'C:/Program Files (x86)/Roblox/Versions/version-*/' -Name "ClientSettings" -ItemType "directory"
          New-Item -Path 'C:/Program Files (x86)/Roblox/Versions/version-*/ClientSettings' -Name "ClientAppSettings.json"
          $flags | ConvertTo-Json -depth 32| set-content -Path 'C:/Program Files (x86)/Roblox/Versions/version-*/ClientSettings/ClientAppSettings.json'

      # Run tests with run-in-roblox
      - name: Run tests
        run: run-in-roblox --place ./tests/test.rbxlx --script ./tests/Curriculum.spec.lua
boatbomber commented 2 years ago

I tried a .rbxl vs .rbxlx and found no difference.

I did find one thing of note- it's possible for the action to work on the first time opening studio and then fail on the second, which suggests that setup/installation/cookie is not related to this issue. image

boatbomber commented 2 years ago

After a lot more testing, I've found that this seems to be tied to StudioUseNewLoginDataEndpoint. (I would appreciate another person verifying this as well.)

A temporary workaround is to disable this feature flag before calling run-in-roblox:


  # Flip flag that causes issue
  - name: Create fflag overrides
    run: |
      $flags = @{DFIntStudioUseNewLoginDataEndpointHundredthPercent=0; FFlagStudioUseNewLoginDataEndpoint=$false}
      New-Item -Path 'C:/Program Files (x86)/Roblox/Versions/version-*/' -Name "ClientSettings" -ItemType "directory"
      New-Item -Path 'C:/Program Files (x86)/Roblox/Versions/version-*/ClientSettings' -Name "ClientAppSettings.json"
      $flags | ConvertTo-Json -depth 32| set-content -Path 'C:/Program Files (x86)/Roblox/Versions/version-*/ClientSettings/ClientAppSettings.json'

  # Run your tests with run-in-roblox
  - name: Run tests
    run: |
      run-in-roblox --place ./tests/test.rbxl --script ./tests/TestRunner.lua
vocksel commented 2 years ago

Adding the following for me has resolved the issue (for now):

- name: Add RBXID to the Windows registry
  run: REG ADD HKCU\Software\RobloxStudioBrowser\roblox.com /t REG_SZ /v .RBXID /d "${{ secrets.RBXID }}"

I have been getting consistent test passes with this step. It also does not appear flipping flags is necessary anymore.

This is something that should be included in roblox-win-installer as it already adds the ROBLOSECURITY cookie to the registry. If someone could look into making this change it would be much appreciated

RuizuKun-Dev commented 2 years ago

What are the odds, I also got the same issue and can't reproduce it locally

image

RuizuKun-Dev commented 2 years ago

@vocksel what is secrets.RBXID and how do I get it?

I assumed is it the Roblox UserId of the cookie owner

After doing both methods the test still fails for me

image

name: Roblox Unit Test

on: [push]

jobs:
  Run-Tests:
    runs-on: windows-latest
    timeout-minutes: 10

    steps:
      - uses: actions/checkout@v1

      - name: Install Tools
        uses: Roblox/setup-foreman@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}

      - name: Install Roblox Studio
        uses: OrbitalOwen/roblox-win-installer-action@1.1
        with:
          cookie: ${{ secrets.ROBLOSECURITY }}
          token: ${{ secrets.GITHUB_TOKEN }}

      - name: Add RBXID to the Windows registry
        run: REG ADD HKCU\Software\RobloxStudioBrowser\roblox.com /t REG_SZ /v .RBXID /d "${{ secrets.RBXID }}"

      # Flip flag that causes issue
      - name: Create fflag overrides
        run: |
          $flags = @{DFIntStudioUseNewLoginDataEndpointHundredthPercent=0; FFlagStudioUseNewLoginDataEndpoint=$false}
          New-Item -Path 'C:/Program Files (x86)/Roblox/Versions/version-*/' -Name "ClientSettings" -ItemType "directory"
          New-Item -Path 'C:/Program Files (x86)/Roblox/Versions/version-*/ClientSettings' -Name "ClientAppSettings.json"
          $flags | ConvertTo-Json -depth 32| set-content -Path 'C:/Program Files (x86)/Roblox/Versions/version-*/ClientSettings/ClientAppSettings.json'

      - name: Run tests
        run: |
          run-in-roblox --place "./Time Attack!.rbxlx" --script ./src/TestService/TestServer/init.lua
          run-in-roblox --place "./Time Attack!.rbxlx" --script ./src/TestService/TestClient/init.lua
vocksel commented 2 years ago

@vocksel what is secrets.RBXID and how do I get it?

RBXID is a cookie required for authenticating with Studio. You can find it in the same place as your ROBLOSECURITY cookie.

I haven't had good luck recently getting this workflow to work, but I'm told that flipping FFlagStudioUseNewLoginDataEndpoint to false (like you're doing) should be enough right now (In conjunction with both ROBLOSECURITY and RBXID as secrets)

But I'm not confident that this solution will last forever

AmberGraceRblx commented 2 years ago

@vocksel Flipping the flag worked for a while, but the most recent CI runs I've had have failed. It's not future proof, and I think the future is now.

recanman commented 2 years ago

My runs have been failing and I can't get this to work.

I realized that Roblox made a change in which cookies are invalidated with IP changes.

How would I go about logging in and getting the cookies from the workflow? I'm not too familiar with these things.

DevelopmentIntensified commented 1 year ago

Any updates on this? I am running into the same issue

fjanetzki commented 4 days ago

I'm running into the same issue.