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

Error Viewing Plugin Settings after Login #1206

Closed
brianhyder opened this Issue Jan 22, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@brianhyder
Member

brianhyder commented Jan 22, 2017

Description:
An error occurs when navigating directly to settings page for a particular plugin after login.

The real cause is that the because the user is not authenticated on the first attempt to view the settings page a 401 error is thrown. The error formatter detects the route has a content type of text/html. The html error formatter then modifies the handle property of the themed route. This value is passed by reference and is therefore mutated by the error handler. When this happens all future requests then attempt to use the handler set by the error formatter which is incorrect and does not exist causing the error to occur. A big thanks to @lgenet for reporting this and tracking down the root cause.

error: System[2]: uncaught Exception detected : TypeError: req.controllerInstance[(intermediate value)(intermediate value)(intermediate value)] is not a function
    at render (/Users/x/Documents/Node Projects/CMSPencilblue/include/http/middleware/index.js:447:95)
    at module.exports.pb._handle.execute (/Users/x/Documents/Node Projects/CMSPencilblue/include/http/router.js:90:17)
    at /Users/x/Documents/Node Projects/CMSPencilblue/include/http/router.js:99:29
    at nextTickCallbackWith0Args (node.js:420:9)
    at process._tickDomainCallback (node.js:390:13)

Steps to Reproduce:

  • Login and install sample plugin
  • Logout
  • Enter /admin/plugins/sample/settings into the address bar of the browser and hit enter
  • After being redirected to login enter admin credentials and click to login

Expected Result:
User is now viewing the settings for the sample plugin.

Actual Result:
PB throws an error with the stack trace noted above

Configuration Details:
Occurs in both single and multi-site

Log Output:
See above stack trace

PencilBlue Version: 0.8.0

Node.js Version: >= 4

Environment Description:
n/a

@brianhyder brianhyder added the bug label Jan 22, 2017

@brianhyder brianhyder added this to the 0.8.1 milestone Jan 22, 2017

@brianhyder brianhyder self-assigned this Jan 22, 2017

brianhyder added a commit that referenced this issue Jan 22, 2017

#1206 fixed issue where unauthorized access of a route that did not h…
…ave a default "render" handler caused a failure after login

@brianhyder brianhyder closed this in #1207 Jan 23, 2017

brianhyder added a commit that referenced this issue Jan 23, 2017

Merge pull request #1207 from pencilblue/issue/1206
#1206 fixed issue where unauthorized access of a route that did not h…

@brianhyder brianhyder removed the in progress label Jan 23, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment