interledger / rafiki

An open-source, comprehensive Interledger service for wallet providers, enabling them to provide Interledger functionality to their users.

Home Page:https://rafiki.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix `frontend` issue when running with NODE_ENV=development

mkurapov opened this issue · comments

Context

Spinning up Rafiki via helm charts results in an error in the frontend package:

Error: Dev server origin not set                                                                                                                                                                                                                         
    at Object.broadcastDevReady (/home/rafiki/node_modules/.pnpm/@remix-run+server-runtime@2.6.0_typescript@5.4.2/node_modules/@remix-run/server-runtime/dist/dev.js:17:22)                                                                              
    at Server.onListen (/home/rafiki/node_modules/.pnpm/@remix-run+serve@2.6.0_typescript@5.4.2/node_modules/@remix-run/serve/dist/cli.js:123:17)                                                                                                        
    at Object.onceWrapper (node:events:631:28)                                                                                                                                                                                                           
    at Server.emit (node:events:529:35)                                                                                                                                                                                                                  
    at emitListeningNT (node:net:1851:10)                                                                                                                                                                                                                
    at processTicksAndRejections (node:internal/process/task_queues:81:21) 

This is a result of:

after we upgraded to remix v2:


The issue/error message was fixed after setting NODE_ENV=production.

It is likely that when the helm charts are setting the NODE_ENV=development when building the frontend package, this causes a _dev_ build of remix to happen, and during `remix-serve` for running the app, the app complains because it expected a dev server.

(Potentially) useful resources:

Todos

  • Fix the error message when running the frontend package in a deployed environment (via helm)

Just to follow up on the possibility of continuing to use development, looking at the remix-serve cli, I do not see any scenario where we can use NODE_ENV=development and not run some sort of dev server. https://github.com/remix-run/remix/blob/9661da31e589fc4eda042ab2f6f963cefba380ed/packages/remix-serve/cli.ts I think this works this way strictly for remix-dev since that uses remix-serve as the app server according to the docs.

If you are running remix dev without the -c flag, then you are implicitly using remix-serve as your app server.

https://remix.run/docs/en/main/guides/manual-mode#remix-serve

Taking a step back, I wonder what NODE_ENV we should be using in our helm charts in general. If used in some staging environment I imagine we would want it to be as close to production as possible, no?

I also added nodeEnv in helm charts so that users can specify nodeEnv in values.yaml file on helm install / upgrade. This is also consistent with other Rafiki packages (auth and backend)

interledger/helm-charts#27

Resolved with env var in helm repo