Skip to content
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

Deployment .env file taking precedence in dev environment #60

Open
riseandshaheen opened this issue Aug 2, 2024 · 3 comments · May be fixed by #61
Open

Deployment .env file taking precedence in dev environment #60

riseandshaheen opened this issue Aug 2, 2024 · 3 comments · May be fixed by #61
Labels
bug Something isn't working

Comments

@riseandshaheen
Copy link

🙂 Expected behavior

When you deploy a Cartesi app on a cloud provider, you have a .env file for node configuration in the app directory. After deployment, if you switch back to local development and run the node, the CLI should ignore the .env file and the Node should run smoothly as it did before deployment.

🫠 Actual behavior

When you spin up the node with cartesi run, the Cartesi CLI reads the node env variables from .env and overrides the default values. This creates a timeout issue for local node as shown below:

Attaching to prompt-1, validator-1
validator-1  | 2024-08-01T15:07:48.190 ERR ERROR r2d2: unnamed prepared statement does not exist service=graphql-server
validator-1  | 2024-08-01T15:07:48.195 ERR ERROR r2d2: unnamed prepared statement does not exist service=graphql-server
validator-1  | 2024-08-01T15:07:50.760 ERR Service timed out service=graphql-server
validator-1  | 2024-08-01T15:07:50.824 ERR Node exited with an error error="timed out waiting for service to be ready"

🧪 Minimal test case

Steps to reproduce:

  1. Create a .env file inside app directory with some production env variables defined.
  2. Build and run the app locally.

🌎 Environment

Local Dev environment - Mac M1 Pro
Cartesi CLI version 0.15.1

✔️ Possible solutions

Currently, quick fix is to simply rename .env file when you're running node in locally.

@riseandshaheen riseandshaheen added the bug Something isn't working label Aug 2, 2024
@endersonmaia
Copy link
Contributor

Since .env can be a valid file for the development environment, we could emit a WARNING in the CLI, suggesting the user to rename the file or be careful with which variable are chosen.

Also, suggest using cartesi.env to override rollups-node ENV variables.

I'm just thinking out loud here.

@endersonmaia endersonmaia linked a pull request Aug 5, 2024 that will close this issue
@tuler
Copy link
Member

tuler commented Aug 5, 2024

Why is there a .env file there? Is it the one created by the deployment procedure? Can we generate one with a different name?

@endersonmaia
Copy link
Contributor

Why is there a .env file there? Is it the one created by the deployment procedure? Can we generate one with a different name?

Yes, we could save with da difffent name.

But there are some language frameworks that use dotenv.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants