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

Error: site is required #220

Closed
howardabrams opened this issue Jan 8, 2015 · 12 comments
Closed

Error: site is required #220

howardabrams opened this issue Jan 8, 2015 · 12 comments
Labels
Milestone

Comments

@howardabrams
Copy link

Kicked of a sx-authenticate and got that working, and next, I run
sx-tab-newest, and it successfully got my favorite groups. I
selected "emacs" (obviously), and it comes up with this error:

Contacting host: api.stackexchange.com:443
progn: Request failed: (nil) [400 bad_parameter] "site is required"

I'll see if I can debug it more later, but if I am doing something
wrong, I would appreciate the pointer, as I'm looking forward to
playing with this fun toy.

@vermiculus
Copy link
Owner

I can't seem to reproduce the issue on the current master from a fresh emacs – can you give us the stacktrace with toggle-debug-on-error?

@Malabarba
Copy link
Collaborator

Also, are you using the latest version from Melpa, or the (not so) stable 0.1 version from Melpa-stable?

@kcandrews
Copy link

Hi, I'm getting the same "site is required" error out of box. Below is the *Backtrace* after enabling toggle-debug-on-error and redacting what looked like my authentication key:

Debugger entered--Lisp error: (error "Request failed: (nil) [400 bad_parameter] \"site is required\"")
  signal(error ("Request failed: (nil) [400 bad_parameter] \"site is required\""))
  error("Request failed: (%s) [%i %s] %S" nil 400 "bad_parameter" "site is required")
  sx-request-make("me/favorites" ((pagesize . 100) (page) (filter . "MAGIC-KEY-REDACTED")) get sx-request-response-get-items)
  sx-method-call(me :submethod favorites :site nil :filter ((question\.question_id \.backoff \.error_id \.error_message \.error_name \.has_more \.items \.page \.page_size \.quota_max \.quota_remaining \.total) nil none) :auth t)
  sx-favorites--retrieve-favorites(nil)
  sx-favorites--update-site-favorites(nil)
  mapc(sx-favorites--update-site-favorites (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil))
  sx-favorites-update()
  sx-favorites--initialize()
  run-hooks(sx-init--internal-hook sx-init-hook)
  sx-initialize()
  sx-tab-frontpage(nil "emacs")
  call-interactively(sx-tab-frontpage record nil)
  command-execute(sx-tab-frontpage record)
  helm-M-x()
  call-interactively(helm-M-x nil nil)
  command-execute(helm-M-x)

I'm using the MELPA version from yesterday (1/7/2015).

@vermiculus
Copy link
Owner

Well here's the culprit -- I'm not sure why this is happening, though

  sx-method-call(me :submethod favorites :site nil :filter (...) :auth t)
  sx-favorites--retrieve-favorites(nil)
  sx-favorites--update-site-favorites(nil)
  mapc(sx-favorites--update-site-favorites (nil nil nil ... nil))

It looks like sx-network--user-sites is just nil over and over again -- @Bruce-Connor, do you remember where this is supposed to be set? sx-network--get-associated, I think? We might need to add this to the init hook.

If this is the issue, the way to reproduce would be to clear our caches.


After clearing my cache at work, I unfortunately cannot reproduce. I'll have a closer look when I get home.

@Malabarba
Copy link
Collaborator

Yes, it looks like sx-network-user-sites is returning a list of nils.

Another problem, which is won't fix this issue but will workaround it (and we should do it anyway), is that we're fetching a list of favorite questions for all sites at initialization. We never use that list, so there's no need to do that.

@Malabarba
Copy link
Collaborator

I confirm I canreproduce this by invalidating my cache.

@Malabarba Malabarba added the bug label Jan 8, 2015
@Malabarba Malabarba added this to the v0.2 milestone Jan 8, 2015
@Malabarba
Copy link
Collaborator

To fix this, we just need to add site_url to sx-site-browse-filter

@vermiculus
Copy link
Owner

@howardabrams @kcandrews -- Can you confirm this has fixed the issue? The next MELPA build should be any minute now, but may be up to an hour away.

@kcandrews
Copy link

Just updated from MELPA (20150108.815). I see site_url in (defconst sx-site-browse-filter ... in sx-site.el so I think this is the latest version? I'm still getting the error, however. The *Backtrace* looks identical as far as I can tell.

Debugger entered--Lisp error: (error "Request failed: (nil) [400 bad_parameter] \"site is required\"")
  signal(error ("Request failed: (nil) [400 bad_parameter] \"site is required\""))
  error("Request failed: (%s) [%i %s] %S" nil 400 "bad_parameter" "site is required")
  sx-request-make("me/favorites" ((pagesize . 100) (page) (filter . "MAGIC-KEY-REDACTED")) get sx-request-response-get-items)
  sx-method-call(me :submethod favorites :site nil :filter ((question\.question_id \.backoff \.error_id \.error_message \.error_name \.has_more \.items \.page \.page_size \.quota_max \.quota_remaining \.total) nil none) :auth t)
  sx-favorites--retrieve-favorites(nil)
  sx-favorites--update-site-favorites(nil)
  mapc(sx-favorites--update-site-favorites (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil))
  sx-favorites-update()
  sx-favorites--initialize()
  run-hooks(sx-init--internal-hook sx-init-hook)
  sx-initialize()
  sx-tab-newest(nil "emacs")
  call-interactively(sx-tab-newest record nil)
  command-execute(sx-tab-newest record)
  helm-M-x()
  call-interactively(helm-M-x nil nil)
  command-execute(helm-M-x)

@Malabarba
Copy link
Collaborator

Do sx-cache-invalidate-all, and try again.

@howardabrams
Copy link
Author

That worked! Thanks a lot for the quick turn-around.

@kcandrews
Copy link

Indeed. Running Bruce's command fixed the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants