Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handlebars: Access has been denied to resolve the property #16

Closed
dameunbite opened this issue Apr 22, 2020 · 5 comments · Fixed by #53
Closed

Handlebars: Access has been denied to resolve the property #16

dameunbite opened this issue Apr 22, 2020 · 5 comments · Fixed by #53
Labels
bug Something isn't working good first issue Good for newcomers released upstream Issue created in another package

Comments

@dameunbite
Copy link

I am having this error in our production code

Handlebars: Access has been denied to resolve the property "_id" because it is not an "own property" of its parent.
Apr 22 00:00:34 dameunbite app/web.1: You can add a runtime option to disable the check or this warning:
Apr 22 00:00:34 dameunbite app/web.1: See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Apr 22 00:00:34 dameunbite app/web.1: Handlebars: Access has been denied to resolve the property "value" because it is not an "own property" of its parent.
Apr 22 00:00:34 dameunbite app/web.1: You can add a runtime option to disable the check or this warning:
Apr 22 00:00:34 dameunbite app/web.1: See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Apr 22 00:00:41 dameunbite app/web.1: (node:4) DeprecationWarning: collection.count is deprecated, and will be removed in a future version. Use Collection.countDocuments or Collection.estimatedDocumentCount instead
Apr 22 00:00:41 dameunbite app/web.1: Handlebars: Access has been denied to resolve the property "status" because it is not an "own property" of its parent.
Apr 22 00:00:41 dameunbite app/web.1: You can add a runtime option to disable the check or this warning:
Apr 22 00:00:41 dameunbite app/web.1: See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Apr 22 00:00:41 dameunbite app/web.1: Handlebars: Access has been denied to resolve the property "orderId" because it is not an "own property" of its parent.
Apr 22 00:00:41 dameunbite app/web.1: You can add a runtime option to disable the check or this warning:
Apr 22 00:00:41 dameunbite app/web.1: See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Apr 22 00:00:41 dameunbite app/web.1: Handlebars: Access has been denied to resolve the property "timesCheckedToAutoDispatch" because it is not an "own property" of its parent.
Apr 22 00:00:41 dameunbite app/web.1: You can add a runtime option to disable the check or this warning:
Apr 22 00:00:41 dameunbite app/web.1: See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Apr 22 00:00:41 dameunbite app/web.1: Handlebars: Access has been denied to resolve the property "paymentConfirmation" because it is not an "own property" of its parent.
Apr 22 00:00:41 dameunbite app/web.1: You can add a runtime option to disable the check or this warning:
Apr 22 00:00:41 dameunbite app/web.1: See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Apr 22 00:00:41 dameunbite app/web.1: Handlebars: Access has been denied to resolve the property "customerOrderedTimes" because it is not an "own property" of its parent.
Apr 22 00:00:41 dameunbite app/web.1: You can add a runtime option to disable the check or this warning:
Apr 22 00:00:41 dameunbite app/web.1: See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Apr 22 00:00:41 dameunbite app/web.1: Handlebars: Access has been denied to resolve the property "customerName" because it is not an "own property" of its parent.
Apr 22 00:00:41 dameunbite app/web.1: You can add a runtime option to disable the check or this warning:
Apr 22 00:00:41 dameunbite app/web.1: See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Apr 22 00:00:41 dameunbite app/web.1: Handlebars: Access has been denied to resolve the property "customerLastName" because it is not an "own property" of its parent.
Apr 22 00:00:41 dameunbite app/web.1: You can add a runtime option to disable the check or this warning:
Apr 22 00:00:41 dameunbite app/web.1: See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Apr 22 00:00:41 dameunbite app/web.1: Handlebars: Access has been denied to resolve the property "orderType" because it is not an "own property" of its parent.
Apr 22 00:00:41 dameunbite app/web.1: You can add a runtime option to disable the check or this warning:
Apr 22 00:00:41 dameunbite app/web.1: See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Apr 22 00:00:41 dameunbite app/web.1: Handlebars: Access has been denied to resolve the property "dishes" because it is not an "own property" of its parent.
Apr 22 00:00:41 dameunbite app/web.1: You can add a runtime option to disable the check or this warning:
Apr 22 00:00:41 dameunbite app/web.1: See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Apr 22 00:00:41 dameunbite app/web.1: Handlebars: Access has been denied to resolve the property "customerPhone" because it is not an "own property" of its parent.
Apr 22 00:00:41 dameunbite app/web.1: You can add a runtime option to disable the check or this warning:
Apr 22 00:00:41 dameunbite app/web.1: See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Apr 22 00:00:41 dameunbite app/web.1: Handlebars: Access has been denied to resolve the property "customerEmail" because it is not an "own property" of its parent.
Apr 22 00:00:41 dameunbite app/web.1: You can add a runtime option to disable the check or this warning:

This is my package.js

{
  "name": "foo",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "nodemon server.js",
    "test": "nodemon ./node_modules/mocha/bin/mocha",
    "snyk-protect": "snyk protect",
    "postinstall": "node server seed && gulp",
    "prepare": "npm run snyk-protect"
  },
  "engines": {
    "node": "10.16.0",
    "npm": "6.9.0"
  },
  "dependencies": {
    "@google/maps": "^1.0.2",
    "ace-builds": "^1.4.1",
    "async": "^2.6.1",
    "asyncawait": "^1.0.8",
    "aws-sdk": "^2.518.0",
    "base64-img": "^1.0.4",
    "blocked": "^1.2.1",
    "body-parser": "^1.18.3",
    "bootstrap": "^3.3.7",
    "bootstrap-select": "^1.13.3",
    "compression": "^1.7.3",
    "connect-flash": "^0.1.1",
    "connect-mongo": "^1.3.2",
    "cookie-parser": "~1.4.3",
    "cors": "^2.8.1",
    "cron": "^1.5.0",
    "csvtojson": "^2.0.8",
    "debug": "https://github.com/leovazquezz1/debug.git",
    "del": "^2.2.2",
    "dotenv": "^2.0.0",
    "eonasdan-bootstrap-datetimepicker": "^4.17.47",
    "expo-server-sdk": "^3.0.1",
    "export-to-csv": "^0.2.1",
    "express": "^4.16.4",
    "express-flash": "0.0.2",
    "express-handlebars": "^3.0.0",
    "express-session": "^1.14.1",
    "extract-numbers": "^1.0.2",
    "fuzzy-search": "^2.1.0",
    "google-libphonenumber": "^3.1.15",
    "graphql-request": "^1.8.2",
    "gulp-cli": "^2.0.1",
    "gulp-less": "^3.5.0",
    "imagemin": "^7.0.1",
    "imagemin-gifsicle": "^7.0.0",
    "imagemin-jpegtran": "^6.0.0",
    "imagemin-optipng": "^7.1.0",
    "imagemin-pngquant": "^8.0.0",
    "is-image": "^3.0.0",
    "jquery": "^3.3.1",
    "json-find": "^2.0.3",
    "kue": "^0.11.6",
    "kue-ui": "^0.1.0",
    "ladda": "^1.0.0",
    "list.js": "^1.5.0",
    "lodash": "^4.17.11",
    "mailchimp-api": "^2.0.7",
    "moment": "^2.22.2",
    "moment-timezone": "^0.4.1",
    "mongo-round": "^1.0.0",
    "mongodb": "^3.4.0",
    "mongoose": "^5.7.5",
    "mongoose-aggregate-paginate-v2": "^1.0.2",
    "mongoose-auto-increment": "^5.0.1",
    "mongoose-autopopulate": "^0.9.1",
    "mongoose-datatables": "^3.2.0",
    "mongoose-paginate": "^5.0.3",
    "morgan": "^1.9.1",
    "multer": "^1.4.1",
    "newrelic": "^5.13.1",
    "node-geocoder": "^3.22.0",
    "node-mocks-http": "^1.7.3",
    "node-url-shortener": "^1.0.1",
    "nodemon": "^1.18.5",
    "npm": "^6.4.1",
    "passport": "^0.3.2",
    "passport-facebook": "^3.0.0",
    "passport-jwt": "^4.0.0",
    "passport-local": "^1.0.0",
    "passport-local-mongoose": "^4.5.0",
    "passport-local-mongoose-email": "^0.1.4",
    "promise": "^8.0.3",
    "q": "^1.4.1",
    "randomstring": "^1.1.5",
    "redis": "^2.8.0",
    "replace-string": "^2.0.0",
    "request": "^2.88.0",
    "sendgrid": "^4.7.0",
    "shortid": "^2.2.14",
    "snyk": "^1.105.0",
    "socket.io": "^2.1.1",
    "stripe": "^7.1.0",
    "stupid-table-plugin": "^1.1.3",
    "supports-color": "^5.5.0",
    "sweetalert2": "^7.28.11",
    "tinymce": "^4.8.4",
    "tracer": "^1.0.2",
    "twilio": "^3.23.2",
    "underscore": "^1.9.1",
    "universal-analytics": "^0.4.20",
    "ws": "^6.1.0"
  },
  "devDependencies": {
    "chai": "^3.5.0",
    "chai-http": "^3.0.0",
    "gulp": "^4.0.0",
    "gulp-livereload": "^3.8.1",
    "gulp-nodemon": "^2.4.2",
    "mocha": "^3.5.3"
  },
  "snyk": true
}

Express config

module.exports = function (app) {
    app.engine('.hbs', exphbs(hbspref.config(config)));
    app.set('views', config.root + '/app/views');
    app.use(express.static(config.root + '/public'));
    app.use(express.static(__dirname));
    app.use('/vendors', express.static(config.root + '/vendors'));
    app.set('view engine', '.hbs');
    app.use(bodyParser.json({limit: '25mb', extended: true}));
    app.use(bodyParser.urlencoded({limit: '25mb', extended: true}));
    app.use(cookieParser());
    app.use(flash());
    app.use(session({
        resave: false,
        saveUninitialized: true,
        secret: 'secret',
        store: new mongoStore({ mongooseConnection: mongoose.connection })
    }));
    app.use(passport.initialize());
    app.use(passport.session());

    app.use(function(req, res, next) {
        res.locals.user = req.user;
        res.locals.messages = req.flash();
        next();
    });
    if (app.get('env') === "development") {
       app.use(logger('dev'));
    }
};

We have 3 servers running with the same code but with different endpoints and somehow this is the only server that is having this error when we moved the build from staging to productions in Heroku

Why is this error ocurring

@UziTech
Copy link
Member

UziTech commented Apr 22, 2020

This looks like an issue in handlebars. express-handlebars only uses the public compile and precompile methods from handlebars.

@UziTech
Copy link
Member

UziTech commented Apr 22, 2020

it looks like this may help: handlebars-lang/handlebars.js#1648 (comment)

@UziTech
Copy link
Member

UziTech commented Apr 22, 2020

@UziTech UziTech added upstream Issue created in another package bug Something isn't working labels Apr 22, 2020
@UziTech
Copy link
Member

UziTech commented Apr 22, 2020

Looks like we should add a way to add runtime options in the render functions.

@UziTech UziTech added the good first issue Good for newcomers label Apr 30, 2020
@github-actions
Copy link

github-actions bot commented Jul 6, 2020

🎉 This issue has been resolved in version 4.0.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers released upstream Issue created in another package
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant