Previewing theme changes locally (Guide Professional and Enterprise) Follow

Comments

34 comments

  • Avatar
    Diziana

    Awesome! Much awaited feature. Thank you.

  • Avatar
    Dan Ross

    Hi Ryan,

    Are there provisions going to be made for accounts that have disabled password based authentication, as this affects API auth as well. 

     

     

  • Avatar
    Ryan McGrew

    Hey @Dan,

    It appears that there is a workaround with using an API token as a password for customers currently using SSO. I am working with some teams internally to get this documented and published and I can let you know when it's published.

    Thanks!

  • Avatar
    Shammel (Edited )

    How do I get rid of this warning when previewing a theme locally?

    Mixed Content: The page at 'https://backlog.zendesk.com/hc/en-us' was loaded over HTTPS, but requested an insecure stylesheet 'http://localhost:4567/guide/style.css'. This content should also be served over HTTPS.

  • Avatar
    Ryan McGrew

    Hey @Shammel,

    You'll need to make your browser allow unsafe scripts. In Chrome, it's fairly easy and you can take a look at the screenshot here https://cl.ly/2p0Z0D1e3x0Z

    Other browsers should be similar.

  • Avatar
    Shammel

    Thanks, @Ryan.

    But I already did that, which allows the CSS and JS to load. The problem is they are loading over HTTP when the page itself is loading over HTTPS.

  • Avatar
    Dan Ross

    When developing locally, you're serving from the filesystem, by default that will be without HTTPS, as no SSL certificates will exist. 

    This error should be showing when doing local development. 

    When you upload your theme to Zendesk Guide, the resources will be hosted under HTTPS (assuming you have an SSL certificate), and you should no longer get those errors. 

     

  • Avatar
    Shammel

    Ok. Thanks @Dan.

  • Avatar
    Shane Case

    @Ryan Is there any documentation on this for users that are using SSO yet?

  • Avatar
    Augusto Cravo Silva

    @Shane,

    You need to set up an API token and authenticate with that if you are using SSO.

    See more in https://developer.zendesk.com/rest_api/docs/core/introduction#api-token

    Your username is: {email}/token and the password is {token}

     

    Hope this helps :)

  • Avatar
    Ryan McGrew

    We've updated the docs for ZAT here - https://developer.zendesk.com/apps/docs/apps-v2/getting_started#create

  • Avatar
    Trapta

    Hi there,

    I am doing local development and every time I am saving changes the live reloading is throwing this error 

    What is wrong here?

    Thanks

  • Avatar
    Ryan McGrew

    @Trapta,

    I haven't seen this error before. Have your tried restarting the ZAT preview session to see if that fixes it? You should be able to hit ctrl-c to kill the process, then type zat theme preview again and navigate to the theme preview start URL.

     

    Thanks!

  • Avatar
    Trapta

    @Ryan,

    I did it several times but that doesn't fix the issue.

    Thanks
    Trapta

  • Avatar
    Ryan McGrew

    @Trapta,

    Is it possible something else in your environment is using port 4567 while you're running this? It could be that is colliding with live reload for ZAT. We haven't seen this issue before, unfortunately.

    Thanks!

  • Avatar
    Trapta

    @Ryan,

    I have checked that too and there is no other environment using this port.

    Thanks

  • Avatar
    Ryan McGrew

    Hmm... I'm not really sure @Trapa. It seems like something on your machine is preventing you from using that port. I haven't seen it reported it by anyone else, so it's hard to diagnose. We're using this library which doesn't have any open issues related to what you're running into - https://github.com/faye/faye-websocket-ruby

  • Avatar
    Emily Coleman (Edited )

    Hello folks! I'm running into an issue where I can't get the server to even start running. I have nothing else running on the same port, and I've got root-level permissions on this machine, so I'm not sure the issue.

    Here's the error:

    /Library/Ruby/Gems/2.3.0/gems/eventmachine-1.2.5/lib/eventmachine.rb:530:in `start_tcp_server': no acceptor (port is in use or requires root privileges) (RuntimeError)

    (this sets off a slew of other errors, but this seems to be the cause).

    I've tried manually setting a different port (with something like zat theme preview -p --port=9200), but I still hit the same error. I've done some googling, but all of the suggestions are coming up useless. 

    Any advice would be greatly appreciated!

  • Avatar
    Jessie - Community Manager

    Hi Emily! I'm checking with our Developer Support team to see if they can help out here.

  • Avatar
    Emily Coleman

    Thanks, you're a hero @Jessie! 🙌

  • Avatar
    Bryan Flynn

    Hi Emily -- sometimes a server can "stick" and still be running in the background -- see if it's still running (where '4567' is the default port number):

    lsof -i -n -P | grep 4567

    You can then kill the process that gets returned using:

    kill -9 <whatever process ID number the above returns>
    If that doesn't do it for you, try running 'gem update', maybe even restart your computer, and try again.
     
  • Avatar
    Emily Coleman

    Hey Bryan—thanks for following up!

    Unfortunately, I don't get any returns when I grep the port number—just comes back with nothing. I tried running a gem update, but no dice on that either. And sadly the restarting didn't come up with anything.

    Do you know if this might be IP address related? I've read a few things about the IP address not binding correctly (as shown in one of the answers here: https://stackoverflow.com/questions/27851440/eventmachine-start-tcp-server-no-acceptor-port-is-in-use-or-requires-root), but I wasn't sure if that was entirely accurate in this use case, since the preview URL is hosted by Zendesk.

    Thanks again for looking into it!

  • Avatar
    Bryan Flynn

    Hi Emily -- just circling back here... is this still happening? Between the time it worked and stopped working, do you recall anything changing?

    I'm thinking maybe your development environment has issues. Maybe it's been a while since you set it up and something has gotten out-of-date between the Ruby version you're running and the expected Ruby gems that ZAT depends on. I've tried running 'zat theme' on a Ruby 2.3 install of my own and it works, so I don't think there's anything fundamentally wrong.

    What I'd like you to try is to set up your development environment following the steps in this article (and the subsequent ones it references). It gets you to a stable environment along with installing tools such as rbenv and nodenv that let you switch between Ruby and Node versions easily. Can you set things up using these instructions and give it a try again?

    https://develop.zendesk.com/hc/en-us/articles/360001069127-System-prep-for-app-developers-1-Setting-up-your-command-line-interface

     

  • Avatar
    drewbeck (Edited )

    Heya! I'm getting an error when running `zat theme preview`. I've installed the `rack` gem in case that might be in, but no change. Any help?

    Thanks!

     

    /Users/drewbeck/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:135:in `require': cannot load such file -- rack (LoadError)
    from /Users/drewbeck/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
    from /Users/drewbeck/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
    from /Users/drewbeck/.rvm/gems/ruby-2.3.1/gems/sinatra-1.4.8/lib/sinatra/base.rb:2:in `<top (required)>'
    from /Users/drewbeck/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:59:in `require'
    from /Users/drewbeck/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:59:in `require'
    from /Users/drewbeck/.rvm/gems/ruby-2.3.1/gems/zendesk_apps_tools-2.9.3/lib/zendesk_apps_tools/theming/server.rb:3:in `<top (required)>'
    from /Users/drewbeck/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:59:in `require'
    from /Users/drewbeck/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:59:in `require'
    from /Users/drewbeck/.rvm/gems/ruby-2.3.1/gems/zendesk_apps_tools-2.9.3/lib/zendesk_apps_tools/theme.rb:132:in `start_server'
    from /Users/drewbeck/.rvm/gems/ruby-2.3.1/gems/zendesk_apps_tools-2.9.3/lib/zendesk_apps_tools/theme.rb:29:in `preview'
    from /Users/drewbeck/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
    from /Users/drewbeck/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
    from /Users/drewbeck/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
    from /Users/drewbeck/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor/invocation.rb:115:in `invoke'
    from /Users/drewbeck/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor.rb:242:in `block in subcommand'
    from /Users/drewbeck/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
    from /Users/drewbeck/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
    from /Users/drewbeck/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
    from /Users/drewbeck/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
    from /Users/drewbeck/.rvm/gems/ruby-2.3.1/gems/zendesk_apps_tools-2.9.3/bin/zat:13:in `<top (required)>'
    from /Users/drewbeck/.rvm/gems/ruby-2.3.1/bin/zat:23:in `load'
    from /Users/drewbeck/.rvm/gems/ruby-2.3.1/bin/zat:23:in `<main>'
    from /Users/drewbeck/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `eval'
    from /Users/drewbeck/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `<main>'

  • Avatar
    Maria McDowell

    I have been attempting to login using `zat theme preview` and the following format (with variations) in .zat:

    {
    "subdomain": "https://ourdomain.zendesk.com",
    "username": "mysername@email.com/token:my-token-from-active-api-tokens",
    "password": "password" (I also tried to insert token here)
    }

    Can someone tell my why this may not be working? This is the error:

    Error  {"error"=>"Couldn't authenticate you"}
  • Avatar
    Augusto Cravo Silva

    @drewbeck Did you have a look https://develop.zendesk.com/hc/en-us/articles/360001075068? Some similar problems are discussed there.

    @Maria, Your "username" should be just "mysername@email.com/token" and the password should be "my-token-from-active-api-tokens"

  • Avatar
    Maria McDowell

    @Augusto: where are "my-token-from-active-api-tokens" found? B/c what you describe is what I have, but perhaps I grabbed the wrong token.

  • Avatar
    Maria McDowell

    Actually, never mind. I read more closely and realized I had misunderstood the documentation. Here is what is in my .zat file, and it works:

    {
    "subdomain": "https://subdomain.zendesk.com",
    "username": "mymail@mycompany.com/token",
    "password": "mytoken"
    }
  • Avatar
    Collin Cunninghame (Edited )

    I ended up here while I was trying to troubleshoot the error that Emily mentioned earlier, with 

    `start_tcp_server': no acceptor

    I figured out that there was something wrong with my /etc/hosts file, and "localhost" wasn't routing to 127.0.0.1 properly. So, if you're in the same boat while trying to use zat, try restoring /etc/hosts to default. (I'm on macOS High Sierra)

  • Avatar
    Jessie - Community Manager

    Thanks for sharing, Collin!

Please sign in to leave a comment.

Powered by Zendesk