<p>I want to run a sails.js application on Google Kubernetes Engine. Running the application docker container locally works perfectly.
The deployment to GKE is done via gitlab Auto-Devops pipelines. Deploying the application to GKE is working so far and I can access pages of the sails.js application using the generated domain by gitlab-CI - e.g. <code>xyz-review-autodevops-123.my.host.com</code></p>

<p>But when accessing pages, only the requested page can be loaded - every asset like images, javascript and css files are not loaded but return a 404.</p>

<p>When looking at the nginx-ingress-controller logs in GKE, I see that these url's are requested but result in a 404:</p>

<pre><code>[05/Aug/2018:12:27:25 +0000] "GET /js/cloud.setup.js HTTP/1.1" 404 9 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.84 Safari/537.36" 573 0.004 [my-app-review-autodevops-1232u0-my-app-443] xx.xx.xx.xx:80 9 0.004 404
</code></pre>

<p>There are also regularly errors logged as the following. I am not sure if this is related to this issue but still want to mention it in case it is:</p>

<pre><code>error obtaining PEM from secret my-app-1239989/review-autodevops-1232u0-my-app-tls: error retrieving secret my-app-1239989/review-autodevops-1232u0-my-app-tls: secret my-app-1239989/review-autodevops-1232u0-my-app-tls was not found"  
</code></pre>

<p>My guess is that ingress does not know the requested host for the assets because they are requested as absolute paths (<code>/js/cloud.setup.js</code>) instead of relative paths (<code>js/cloud.setup.js</code>) and therefore does not know where to route this request to because the domain information is lost in the request.</p>

<p>But I do now kow how I fix this 404 issue. Would changing all paths to relative paths in sails.js fix it? I even don't know if this can easily be done since quite some are generated by grunt tasks in sails.js and are generated in the absolute form.</p>

sceee
<p>Ok, found the error by myself.
This was a silly mistake because sails was somehow configured to include <code>grunt</code> and <code>sails-hook-grunt</code> only as devdependencies in <code>package.json</code>.</p>

<p>Since on the production container, <code>NODE_ENV</code> is set as environment variable, <code>npm install</code> only installs the production dependencies.</p>

<p>And since grunt is used for manipulating and providing the assets in sails.js, those have just not been generated.</p>

<p>The solution was to move <code>grunt</code> and <code>sails-hook-grunt</code> to the <code>dependencies</code> in <code>package.json</code>.</p>
