{"action":"created","issue":{"url":"https://api.github.com/repos/sgentle/phantomjs-node/issues/261","labels_url":"https://api.github.com/repos/sgentle/phantomjs-node/issues/261/labels{/name}","comments_url":"https://api.github.com/repos/sgentle/phantomjs-node/issues/261/comments","events_url":"https://api.github.com/repos/sgentle/phantomjs-node/issues/261/events","html_url":"https://github.com/sgentle/phantomjs-node/issues/261","id":64982426,"number":261,"title":"Undefined is not a function when calling page.set","user":{"login":"fdvj","id":2347974,"avatar_url":"https://avatars.githubusercontent.com/u/2347974?v=3","gravatar_id":"","url":"https://api.github.com/users/fdvj","html_url":"https://github.com/fdvj","followers_url":"https://api.github.com/users/fdvj/followers","following_url":"https://api.github.com/users/fdvj/following{/other_user}","gists_url":"https://api.github.com/users/fdvj/gists{/gist_id}","starred_url":"https://api.github.com/users/fdvj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fdvj/subscriptions","organizations_url":"https://api.github.com/users/fdvj/orgs","repos_url":"https://api.github.com/users/fdvj/repos","events_url":"https://api.github.com/users/fdvj/events{/privacy}","received_events_url":"https://api.github.com/users/fdvj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-03-28T20:09:09Z","updated_at":"2015-04-14T19:59:33Z","closed_at":null,"body":"Im getting this error:\r\n```phantom stdout: TypeError: 'undefined' is not a function (evaluating 'key.split('.')')\r\n< phantom stdout:   /home/fernando/Projects/SpinPlug/core-api/node_modules/phantom/shim.js:5436\r\n<   /home/fernando/Projects/SpinPlug/core-api/node_modules/phantom/shim.js:5477\r\n<   /home/fernando/Projects/SpinPlug/core-api/node_modules/phantom/shim.js:4526\r\n<   /home/fernando/Projects/SpinPlug/core-api/node_modules/phantom/shim.js:4502\r\n<   /home/fernando/Projects/SpinPlug/core-api/node_modules/phantom/shim.js:4382\r\n<   /home/fernando/Projects/SpinPlug/core-api/node_modules/phantom/shim.js:4370\r\n<   /home/fernando/Projects/SpinPlug/core-api/node_modules/phantom/shim.js:439 in ondata\r\n<   /home/fernando/Projects/SpinPlug/core-api/node_modules/phantom/shim.js:595\r\n<   /home/fernando/Projects/SpinPlug/core-api/node_modules/phantom/shim.js:408\r\n<   /home/fernando/Projects/SpinPlug/core-api/node_modules/phantom/shim.js:1124\r\n<   /home/fernando/Projects/SpinPlug/core-api/node_modules/phantom/shim.js:2033\r\n<   /home/fernando/Projects/SpinPlug/core-api/node_modules/phantom/shim.js:2091\r\n<   /home/fernando/Projects/SpinPlug/core-api/node_modules/phantom/shim.js:2223\r\n```\r\n\r\nCode (ignore the initializePhantom which is just to make sure phantom process doesnt stay alive when killing the app): ```function generateFromPath(filename, url, pageSize) {\r\n    if (typeof filename !== 'string') {\r\n      return \r\n    }\r\n\r\n    if (!pageSize) {\r\n      format: 'A4'\r\n    }\r\n\r\n    var deferred = Q.defer();\r\n    initializePhantom(function(){\r\n      ph.createPage(function(page){\r\n        try {\r\n          var file = path.normalize(tempdir + '/' + filename + '.pdf');\r\n          page.open('http://localhost:' + sails.config.port + url, function(status){\r\n            // Page set triggers the isue. Render below works correctly\r\n            page.set({\r\n              format: pageSize\r\n            }, function() {\r\n              page.render(file, function(){\r\n                page.close();\r\n                setForDeletion(file);\r\n                return deferred.resolve(file);\r\n              });\r\n            });\r\n          });\r\n        } catch (e) {\r\n          if (page) {\r\n            page.close();\r\n            return deferred.reject(e);\r\n          }\r\n        }\r\n      });\r\n    });\r\n    return deferred.promise;\r\n  }```"},"comment":{"url":"https://api.github.com/repos/sgentle/phantomjs-node/issues/comments/93041564","html_url":"https://github.com/sgentle/phantomjs-node/issues/261#issuecomment-93041564","issue_url":"https://api.github.com/repos/sgentle/phantomjs-node/issues/261","id":93041564,"user":{"login":"jonyet","id":1554641,"avatar_url":"https://avatars.githubusercontent.com/u/1554641?v=3","gravatar_id":"","url":"https://api.github.com/users/jonyet","html_url":"https://github.com/jonyet","followers_url":"https://api.github.com/users/jonyet/followers","following_url":"https://api.github.com/users/jonyet/following{/other_user}","gists_url":"https://api.github.com/users/jonyet/gists{/gist_id}","starred_url":"https://api.github.com/users/jonyet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonyet/subscriptions","organizations_url":"https://api.github.com/users/jonyet/orgs","repos_url":"https://api.github.com/users/jonyet/repos","events_url":"https://api.github.com/users/jonyet/events{/privacy}","received_events_url":"https://api.github.com/users/jonyet/received_events","type":"User","site_admin":false},"created_at":"2015-04-14T19:59:33Z","updated_at":"2015-04-14T19:59:33Z","body":"well, not sure this will help you, but here is an example of page.set working just fine within my framework:\r\n\r\n```javascript\r\nDocument.prototype.captureScreenshot = function(next) {\r\n    console.log(\">> Rendering screencap for \" + this.id)\r\n    var self = this;\r\n    phantom.create(function(ph) {\r\n        ph.createPage(function(page) {\r\n            page.setContent(self.html);\r\n            page.set(\"viewportSize\", {\r\n                width: 1920,\r\n                height: 1080\r\n            });\r\n            page.set('onLoadFinished', function(success) {\r\n            \tvar outputFile = './screenshots/screenshot-' + self.id + '.png';\r\n            \tpage.render(outputFile);\r\n            \tph.exit();\r\n            \tconsole.log(\">> Render complete for \" + self.id)\r\n            \tif (next)\r\n            \t    next(outputFile);\r\n            })\r\n        });\r\n    });\r\n}\r\n```\r\nhope this will help you out! using phantom 1.9.8 and module v 0.7.1"}}