metalbear-co / mirrord

Connect your local process and your cloud environment, and run local code in cloud conditions.
https://mirrord.dev
MIT License
3.75k stars 101 forks source link

Not able to load environment variables via intellij #2785

Open scottillogical opened 1 day ago

scottillogical commented 1 day ago

Bug Description

I recently got a new mac, setting it up I am not able to get intellij mirrord to load the environment variables correctly. This worked on my previous mac fine

Via CLI it works fine

mirrord exec -a scott1 --target=deployment/<APP> -- bash
$ env | grep MIRRORD_AGENT_NAMESPACE=scott1
MIRRORD_AGENT_NAMESPACE=scott1

But when I start up the java app in intellij, it does not load the environment variables from the target pod

Screenshot 2024-09-27 at 12 31 05 PM

Since in the past this has been due to SIP issue https://mirrord.dev/docs/faq/common-issues/ I copied my JDK into ~/java, but this did not ameliorate the issue

I also tried running sudo codesign --remove-signature ./<your-binary> but after that I could not boot the jdk without it exiting immediately afterwards. I tried other jdks no dice thus far

Steps to Reproduce

  1. Run java app in intellij
  2. Observe no environment variables

Backtrace

No response

Relevant Logs

No response

Your operating system and version

osx sonoma 14.7

Local process

$| file $JAVA_HOME/bin/java /Users/sschulthess/.jenv/versions/corretto64-1.8.0.422/bin/java: Mach-O 64-bit executable arm64

Local process version

$| java -version openjdk version "1.8.0_422" OpenJDK Runtime Environment Corretto-8.422.05.1 (build 1.8.0_422-b05) OpenJDK 64-Bit Server VM Corretto-8.422.05.1 (build 25.422-b05, mixed mode)

Additional Info

config file

{
    "target": {
        "path": {
            "deployment": "APP"
        },
        "namespace": "scott1"
    },
    "agent": {
        "namespace": "scott1"
    },
    "feature": {
        "network": {
            "incoming": "steal",
            "outgoing": {
                "filter": {
                    "local": [
                        "localhost:3000"
                    ]
                }
            }
        },
        "fs": "read"
    },
    "kube_context": "zc-carsharing-dev"
}
linear[bot] commented 1 day ago

MBE-422 Not able to load environment variables via intellij

aviramha commented 1 day ago

Hi, Environment variables can't be affected by SIP so it's probably not that. Can you enable internal proxy logs by adding this to your mirrord.json:

{"internal_proxy": {"log_destination": "/tmp/internal_proxy.log", "log_level": "mirrord=trace"}}

then after running attaching the logs (after redacting sensitive information?

aviramha commented 1 day ago

User was able to reproduce it in a vanilla project launching "gradle run" - so perhaps the problem is with the gradle/intellij integration (not using IntelliJ's compilation/execution)