readium / r2-streamer-js

NodeJS Readium2 "streamer"
BSD 3-Clause "New" or "Revised" License
21 stars 10 forks source link

Broken deployed app on Now.sh (works in Heroku) #33

Closed danielweck closed 5 years ago

danielweck commented 6 years ago
(node:80) UnhandledPromiseRejectionWarning: TypeError: obj.hasOwnProperty is not a function
    at Array.forEach (<anonymous>)
    at Object.keys.forEach (/home/nowuser/src/node_modules/r2-utils-js/dist/es8-es2017/src/_utils/JsonUtils.js:32:21)
    at traverseJsonObjects_ (/home/nowuser/src/node_modules/r2-utils-js/dist/es8-es2017/src/_utils/JsonUtils.js:31:26)
    at Object.keys.forEach (/home/nowuser/src/node_modules/r2-utils-js/dist/es8-es2017/src/_utils/JsonUtils.js:35:21)
    at Array.forEach (<anonymous>)
    at traverseJsonObjects_ (/home/nowuser/src/node_modules/r2-utils-js/dist/es8-es2017/src/_utils/JsonUtils.js:31:26)
    at Object.keys.forEach (/home/nowuser/src/node_modules/r2-utils-js/dist/es8-es2017/src/_utils/JsonUtils.js:35:21)
    at Array.forEach (<anonymous>)
    at traverseJsonObjects_ (/home/nowuser/src/node_modules/r2-utils-js/dist/es8-es2017/src/_utils/JsonUtils.js:31:26)
    at Object.keys.forEach (/home/nowuser/src/node_modules/r2-utils-js/dist/es8-es2017/src/_utils/JsonUtils.js:35:21)
    at Array.forEach (<anonymous>)
    at traverseJsonObjects_ (/home/nowuser/src/node_modules/r2-utils-js/dist/es8-es2017/src/_utils/JsonUtils.js:31:26)
    at traverseJsonObjects_ (/home/nowuser/src/node_modules/r2-utils-js/dist/es8-es2017/src/_utils/JsonUtils.js:26:17)
    at Object.keys.forEach (/home/nowuser/src/node_modules/r2-utils-js/dist/es8-es2017/src/_utils/JsonUtils.js:35:21)
    at Array.forEach (<anonymous>)
    at traverseJsonObjects_ (/home/nowuser/src/node_modules/r2-utils-js/dist/es8-es2017/src/_utils/JsonUtils.js:31:26)
(node:80) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
danielweck commented 6 years ago

Test: https://readium2.now.sh

vs. https://readium2.herokuapp.com

danielweck commented 6 years ago

NodeJS runtime: Now: 10.7.0 Heroku: 10.9.0

danielweck commented 6 years ago

NPM: Heroku: 6.4.0 Now: 6.1.0

danielweck commented 6 years ago

TypeScript code reference: https://github.com/readium/r2-utils-js/blob/023fdd0391f5ed15f30fdfc8419ea74c750d5257/src/_utils/JsonUtils.ts#L44

danielweck commented 6 years ago

Javascript code reference (ES8-2017): https://github.com/edrlab/r2-utils-js-dist/blob/bcb231232fa7a6b0dda8bae4ee8b6775b3e82e5c/dist/es8-es2017/src/_utils/JsonUtils.js#L32

danielweck commented 6 years ago

This looks like a TAJSON serialization failure. There is another error, probably related: https://r2-streamer-js-gizgtwvnnp.now.sh/pub/L2hvbWUvbm93dXNlci9zcmMvbWlzYy9lcHVicy93YXN0ZWxhbmQtb3RmLW9iZl9MQ1BfZGFuLmVwdWI%3D/manifest.json

Internal Server Error

TypeError: lcpl.init is not a function
danielweck commented 6 years ago

Tried to manually force NPM install dependencies into node_modules, to no avail. https://github.com/readium/r2-streamer-js/commit/27f3d69ddbee4da724ba49463ee421aa7dfd3ebe

This bizarre bug looks specific to Now.sh, and I think the problem started since we migrated r2-xxx-js packages from GitHub "dist" repositories to proper NPM with semantic versioning (thus why I thought it could be a NPM cache issue in Now.sh infrastructure)

danielweck commented 6 years ago

Now.sh documentation: https://zeit.co/docs/deployment-types/node https://zeit.co/blog/faster-javascript-deployments

danielweck commented 5 years ago

Works fine now (probably a temporary NPM issue)