Closed dustinleblanc closed 2 years ago
Looking at this, it was because my .platform/routes.yaml
was empty
@dustinleblanc does platform REQUIRE a route exist? Seems like no?
@pirog from what I can tell, our code requires a route to exist, not sure if the platform, in general, requires it. If I tell this function to just skip manipulating the routes if they are empty, I get an error in a different part of the code. I was actually thinking of something like this:
/*
* Helper to set primary route if needed
*/
const setPrimaryRoute = (routes = {}) => {
// If we dont have a primary then set one
if (_.isEmpty(routes)) {
routes = {
'http://{default}/': {
type: 'upstream',
primary: true,
upstream: "app:http"
}
}
}
if (!_.some(routes, 'primary')) {
const firstUpstream = _.find(routes, {type: 'upstream'});
firstUpstream.primary = true;
}
// Return
return routes;
};
That feels like a safe assumption, that if someone set up an app but hadn't yet configured routes for the platform, that we'd just have a default route that loads the app
container, but I haven't PR'd that because I wasn't sure if that was a good idea or not.
We could set aside some time to try testing an app spin up with no routes defined, but I don't have enough knowledge of their setup yet to know for sure what happens.
@dustinleblanc ok, let me take some time to think about how we should handle this. To replicate i assume i just delete my routes file and lando rebuild
?
Yeah that seems to be what caused it. I was trying to get rid of any extra cruft in that directory, but I didn't realize it had important files in it.
I can replicate!
Getting this error:
Here is the anonymized Lando config.
Looking at the
setPrimaryRoute
method, it assumes the incoming argument is an array, when I dump the value for this app, it is an empty object ({}
).