node-squarespace-server icon indicating copy to clipboard operation
node-squarespace-server copied to clipboard

Cannot read property 'typeName' of undefined

Open LisaCarlson opened this issue 10 years ago • 7 comments

Hi @kitajchuk, I recently tried to switch a project over to start developing locally and I encountered this error. I have version 0.4.18 and tried running the sqs buster, but keep getting this error. The page will load at first but will then error out immediately after load. Any thoughts appreciated. Thanks! screen shot 2015-12-03 at 11 09 17 am

LisaCarlson avatar Dec 03 '15 18:12 LisaCarlson

It looks like a CSS file is trying to load like a page... How are you loading that CSS file?

kitajchuk avatar Dec 03 '15 19:12 kitajchuk

I guess for better clarification - how are you trying to load that widgets.css file? Link tag in the header? Also, where is it located in your template structure?

kitajchuk avatar Dec 03 '15 19:12 kitajchuk

Hi @kitajchuk, I get similar bugs, today it's js source map being parsed as page:

> sqs-log Get local cache for key => page-scripts-underscore-min.map.html
> sqs-log Get local cache for key => page-scripts-underscore-min.map.json
> sqs-log Store local cache for key => page-scripts-underscore-min.map.json
> sqs-log Store local cache for key => page-scripts-underscore-min.map.html
> sqs-log Get local cache for key => page-scripts-underscore-min.map.html
/usr/lib/node_modules/node-squarespace-server/squarespace-template.js:466
    pageJson.nodeServer = true;
                        ^

TypeError: Cannot set property 'nodeServer' of null
    at Object.renderTemplate (/usr/lib/node_modules/node-squarespace-server/squarespace-template.js:466:25) 

Script being used in page like others with SQS script tag. Any thoughts would be great.

<squarespace:script src="underscore-min.js" combo="true" />

effisfor avatar Jun 16 '16 14:06 effisfor

Anybody desperate in the meantime*, I had to hack squarespace-server.js with the following:

At the top:

rMap = /\.map$/,

Around line 400:

    // Javascript Source Maps
    if ( rMap.test( appRequest.params[ 0 ] ) ) {

      return;
    }

* Once Squarespace had generated a map of underscore, I couldn't get rid of it.

effisfor avatar Jun 16 '16 15:06 effisfor

What version of the node server are you running? If you just update it this is already handled from quite some time ago - https://github.com/NodeSquarespace/node-squarespace-server/blob/master/squarespace-server.js#L31

The server is on version 0.5.43.

kitajchuk avatar Jun 17 '16 00:06 kitajchuk

Hey, yep, on latest version.

effisfor avatar Jun 17 '16 09:06 effisfor

I see. You're getting a js map file problem. This is sort of a bummer scenario since you ideally want to allow maps for your actual app js which is super handy. Maybe I can get in there and find a better way to process and try to serve map files.

kitajchuk avatar Jun 17 '16 16:06 kitajchuk