americanexpress/one-app

Errors thrown when evaluating ModuleRoute properties kill the server

Closed this issue ยท 8 comments

๐Ÿž Bug Report

Describe the bug

Errors thrown when evaluating ModuleRoute properties kill the server.

$ npm start
...
> @americanexpress/one-app@5.2.0 serve-module /opt/one-app
> serve-module "/opt/module-workspace/my-module"

log: one-app-dev-cdn only using locally served modules
โœ” ๐Ÿ‘• one-app-dev-cdn server listening on port 3001
โœ” ๐Ÿ‘– one-app-dev-proxy server listening on port 3002
โœ” ๐Ÿ“Š Metrics server listening on port 3005
โœ” ๐ŸŒŽ One App server listening on port 3000
โœ” Polled Holocron Module map: no updates (polling again in 8s)
ReferenceError: a is not defined
    at http://localhost:3001/static/modules/my-module/3.1.0/my-module.node.js:9992:15
    at passChildrenProps (/opt/one-app/node_modules/holocron-module-route/lib/ModuleRouteUtils.js:33:52)
    at /opt/one-app/node_modules/holocron-module-route/lib/ModuleRouteUtils.js:72:27
$

To Reproduce

  1. Create a childRoutes variable with a ModuleRoute that throws an error when evaluating the properties.
export default () => [
  <ModuleRoute path="test" property={a.b} />,
];
  1. Navigate to http://localhost:3000/test

  2. Server exits.

Expected behavior

Server stays running and prints an error handler message.

System information

  • OS: macOS
  • Browser (if applies) Chrome
  • Version of one-app: 5.2.0
  • Node version: 10.13.0
  • Are you using building one-app from source or using the release Docker image? Docker image
  • Hosting platform for one-app server: n/a
  • Hosting platform/CDN for your one-app modules: n/a

Hey @smackfu! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, you can request an invite to our Slack community that typically always has someone willing to help."

This issue is stale because it has been open 30 days with no activity.

This issue is stale because it has been open 30 days with no activity.

With the latest changes in One App, I believe this is fixed. I tried with the following examples and the app does not crash and the page loads.

const a = {
  b: 'hello',
};

const childRoutes = () => [
  <ModuleRoute path="/" property={a.b} />,
];
const a = 'hello';

const childRoutes = () => [
  <ModuleRoute path="/" property={a} />,
];

@JamesSingleton unfortunately, just ran into this again on v5.7.0. Crashed the process.

I think my reproduce example was unclear -- you should NOT define the a variable. It should be undefined.

This issue is stale because it has been open 30 days with no activity.

This issue is stale because it has been open 30 days with no activity.

This issue is stale because it has been open 30 days with no activity.