kitajchuk / node-squarespace-server

DEPRECATED! A local Squarespace development server in node.js.
MIT License
186 stars 26 forks source link

localhost 5050 refused to connect. #182

Closed hortongroup136 closed 8 years ago

hortongroup136 commented 8 years ago

After running sqs server the site loads on :5050, allows me to log in, but as soon as I click on any menu link the site pukes and gives me this error:

/Users/admin/.nvm/versions/node/v4.4.0/lib/node_modules/node-squarespace-server/squarespace-template.js:464
    pageJson.nodeServer = true;
                        ^

TypeError: Cannot set property 'nodeServer' of null
    at Object.renderTemplate (/Users/admin/.nvm/versions/node/v4.4.0/lib/node_modules/node-squarespace-server/squarespace-template.js:464:25)
    at /Users/admin/.nvm/versions/node/v4.4.0/lib/node_modules/node-squarespace-server/squarespace-server.js:277:29
    at /Users/admin/.nvm/versions/node/v4.4.0/lib/node_modules/node-squarespace-server/node_modules/node-squarespace-middleware/squarespace-middleware.js:393:13
    at Request._callback (/Users/admin/.nvm/versions/node/v4.4.0/lib/node_modules/node-squarespace-server/node_modules/node-squarespace-middleware/squarespace-middleware.js:314:9)
    at Request.self.callback (/Users/admin/.nvm/versions/node/v4.4.0/lib/node_modules/node-squarespace-server/node_modules/request/request.js:200:22)
    at emitTwo (events.js:87:13)
    at Request.emit (events.js:172:7)
    at Request.<anonymous> (/Users/admin/.nvm/versions/node/v4.4.0/lib/node_modules/node-squarespace-server/node_modules/request/request.js:1067:10)
    at emitOne (events.js:82:20)
    at Request.emit (events.js:169:7)

I can run sqs buster, but it just gives me the same error after I click on a link.

kitajchuk commented 8 years ago

Hmm. This error is saying that the response JSON from the request is null. Do you have all the correct information in your template.conf? If you have a sitewide password, you need that. And if your site is in trial mode you need to specify the sandbox:true setting as well. Lastly, are you using the latest version of the server?

hortongroup136 commented 8 years ago

Server version:

$ sqs --version
> sqs-log Node Squarespace Server version 0.5.2

template.conf file shows:

{
  "server": {
    "siteurl": "https://hg-nf2n.squarespace.com/",
    "sandbox": true
  },

Don't have a sitewide pass.

kitajchuk commented 8 years ago

When I visit that squarespace domain I see a page claiming no such account exists:

No Such Account The account you requested does not exist.

hortongroup136 commented 8 years ago

My mistake. Here is the correct template.conf info:

{
  "server": {
    "siteurl": "https://horton-group-nf4n.squarespace.com/",
    "sandbox": true
  },
kitajchuk commented 8 years ago

What template are you using as your base?

hortongroup136 commented 8 years ago

Bedford

cassaram09 commented 8 years ago

Hey guys any luck with this? I'm having the same issue. Server starts up fine but if I navigate to the home page to login my connection is refused.

Using the developer Base template.

Server version: > sqs-log Node Squarespace Server version 0.5.43

Template.conf

"server": {
    "siteurl": "https://matt-cassara-r9xp.squarespace.com/",
    "sandbox": true
  },

Error:

/usr/local/lib/node_modules/node-squarespace-server/squarespace-template.js:466
    pageJson.nodeServer = true;
                        ^

TypeError: Cannot set property 'nodeServer' of null
    at Object.renderTemplate (/usr/local/lib/node_modules/node-squarespace-server/squarespace-template.js:466:25)
    at /usr/local/lib/node_modules/node-squarespace-server/squarespace-server.js:288:33
    at /usr/local/lib/node_modules/node-squarespace-server/node_modules/node-squarespace-middleware/squarespace-middleware.js:393:13
    at Request._callback (/usr/local/lib/node_modules/node-squarespace-server/node_modules/node-squarespace-middleware/squarespace-middleware.js:314:9)
    at Request.self.callback (/usr/local/lib/node_modules/node-squarespace-server/node_modules/request/request.js:200:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request.<anonymous> (/usr/local/lib/node_modules/node-squarespace-server/node_modules/request/request.js:1067:10)
kitajchuk commented 8 years ago

This is tough to debug. Do you have old credentials stored in keychain access?

kitajchuk commented 8 years ago

Also, if you try passing a different port does it let you run it on that?

cassaram09 commented 8 years ago

I did have the old credentials stored in keychain. I deleted them, cleared the local cache, and restarted the server on port 5050. It renders the login page, but if I attempt to "log in" I get the same error. Changing the port didn't work either.

(node:10778) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
> sqs-log Issue compiling less file `base.less` => 'sqs-grid-breaker.less' wasn't found
> sqs-log Squarespace server running localhost:5050
> sqs-log Logging into Squarespace...
> sqs-log ...Logged in to Squarespace
> sqs-log Fetching data from Squarespace...
> sqs-log Fetched fullData for collection 5761bc67d2b857b357d24743
> sqs-log Fetched fullData for collection 5761bc3d59cc68b36d622914
> sqs-log Fetched fullData for collection 5761bcb659cc68b36d622d62
> sqs-log Fetched fullData for collection 57621e45b3db2b9410caa561
> sqs-log Fetched fullData for collection 5761b7ae3c44d8977ad60941
> sqs-log ...Fetched data from Squarespace
> sqs-log Get local cache for key => page-homepage.html
> sqs-log Get local cache for key => page-homepage.json
> sqs-log Error requesting page json from Squarespace with middleware => <p>We couldn't find the page you were looking for. This is either because:</p><ul><li>There is an error in the URL entered into your web browser. Please check the URL and try again.</li><li>The page you are looking for has been moved or deleted.</li></ul><p>You can return to our homepage by <a href="/">clicking here</a>, or you can try searching for the content you are seeking by <a href="javascript:Y.Squarespace.Singletons.Search.show();">clicking here</a>.</p>
> sqs-log Error requesting page => <p>We couldn't find the page you were looking for. This is either because:</p><ul><li>There is an error in the URL entered into your web browser. Please check the URL and try again.</li><li>The page you are looking for has been moved or deleted.</li></ul><p>You can return to our homepage by <a href="/">clicking here</a>, or you can try searching for the content you are seeking by <a href="javascript:Y.Squarespace.Singletons.Search.show();">clicking here</a>.</p>
/usr/local/lib/node_modules/node-squarespace-server/squarespace-template.js:466
    pageJson.nodeServer = true;
kitajchuk commented 8 years ago

@cassaram09 do you not have a homepage? I don't even think you can have that scenario but I have seen an issue where this happened because someone had no pages. But it definitely looks like you are getting a 404 back from Squarespace on that request. The good news is you're getting through the login portal and all the API endpoints are clearing.

cassaram09 commented 8 years ago

@kitajchuk Yep - thought I had one of my pages set for the home page I guess not. Thanks a lot, really appreciate it!

chrisschaub commented 8 years ago

For us, we had changed our master SquareSpace password and so the sqs server could not authenticate and get a json object. @kitajchuk suggestion to clear keychain access of any squarespace keys did the trick. Just open keychain access on osx and remove any squarespace keys. And then restart the sqs server.