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

Failed to get connection options from parse server in time #1383

Closed
jonny-ras opened this issue Aug 17, 2023 · 1 comment
Closed

Failed to get connection options from parse server in time #1383

jonny-ras opened this issue Aug 17, 2023 · 1 comment

Comments

@jonny-ras
Copy link

jonny-ras commented Aug 17, 2023

Hi there, I've been using prettier-ruby to great success for the past few months. We recently upgraded to 4.0.2, and I (only me, my teammates aren't experiencing the problem) haven't been able to get prettier to work with VScode any more.

It does work through the CLI, however.

  • Node version: v20.3.0
  • Ruby version: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [-darwin22] (EOL but we're stuck for now)
  • Prettier version: 3.0.0
  • Prettier-ruby version: 4.0.2
  • Bundler version: 2.3.26

I get this error message in the OUTPUT section of VSCode.

["DEBUG" - 16:55:55] Local prettier module path: '/Users/jonny/app/node_modules/prettier/index.cjs'
["INFO" - 16:55:55] Using config file at '/Users/jonny/app/.prettierrc.js'
["ERROR" - 16:55:58] Error formatting document.
["ERROR" - 16:55:58] Failed to get connection options from parse server in time. If this happens repeatedly, try increasing the PRETTIER_RUBY_TIMEOUT_MS environment variable beyond 10000.
Error: Failed to get connection options from parse server in time. If this happens repeatedly, try increasing the PRETTIER_RUBY_TIMEOUT_MS environment variable beyond 10000.
    at Timeout._onTimeout (file:///Users/jonny/app/node_modules/@prettier/plugin-ruby/src/plugin.js:131:16)
    at listOnTimeout (node:internal/timers:559:17)
    at process.processTimers (node:internal/timers:502:7)
["INFO" - 16:55:58] Formatting completed in 10004ms.

I have the required gems installed

$ gem list | grep syntax
syntax_tree (6.1.1)
syntax_tree-haml (4.0.3)
syntax_tree-rbs (1.0.0)

$ gem list | grep prettier
prettier (4.0.1, 4.0.0, 2.0.0)
prettier_print (1.2.1)

Based on the title of #1359 I should be getting an error if the gems aren't installed correctly, and I'm not.

Things I've tried:

Things I've checked:

  • My global node version (using nvm) is the same as in my project, the default is v20.3.0
  • My global ruby version (using rbenv) is the same as in my project
  • The CLI works, as I mentioned, but it's quite slow
$ ./node_modules/.bin/prettier --write 'app/workers/realtime/subscriptions_delivery_worker.rb' 
[warn] Ignored unknown option { rubyArrayLiteral: false }.
app/workers/realtime/subscriptions_delivery_worker.rb 2546ms

I'm confident this is a configuration problem with my laptop, as my teammates aren't seeing this. But I don't know what else to try, so submitting this issue as a last ditch plea for help.

Thanks!

@jonny-ras
Copy link
Author

Hey there, I've managed to make this work again, although I'll admit, I'm not entirely sure how it fixes it, just that it does.

For context, I'm on an M1 Mac, which I think was the source of the issues from the outset.

The steps I took:

  1. I opened up the developer tools and realised that the server.rb was actually crashing due to a segmentation fault
    image
  2. That segmentation fault seems to just be a bug with 2.7.1 - we're working on upgrading, but upgrading to 2.7.3 wasn't an option for me yet.
  3. I uninstalled ruby 2.7.1 using rbenv (rbenv uninstall 2.7.1 ), and then I removed the shims (rm ~/.rbenv/shims/.rbenv-shim)
  4. I reinstalled ruby 2.7.1 from scratch.
  5. Using the default bundler (2.1.4) on ruby 2.7.1 I installed the required gems again
  6. It just started working again.

I'm not sure what it is about clearing the shims / using bundler 2.1.4 to install the gems, but whatever it is, it worked.

Hopefully this will help anyone struggling to get it to work.

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

1 participant