Creating / changing environment vars in build plugins does not affect other build plugins

Hi,

I’m currently using netlify-plugin-contextual-env to set different env values depending on the context I.E. Deploy Preview. Another build plugin i’m using is netlify-plugin-cypress. For this to run successfully I need the cypress plugin to have the updated env variable value but it is still picking up the original value.

I’ve tried creating two custom plugins locally, the first one sets an environment variable and the second tries to read it. The behaviour i’m seeing is that the first plugin sets it successfully and I can console log out the value in both the preBuild and postBuild of the first plugin. However where ever I log it out in the second plugin it is undefined.

Is this an expected behaviour? I have previously had this working but as of last week this started failing.

Here is an example repo: https://github.com/alexjfno1/plugin-test

Logs:

Hi @alexjfno1,

Thanks for reporting this.

Since last week, we have been removing the possibility for plugins to communicate to each other using environment variables due to security concerns. We are considering re-introducing this capability in the future but probably using a utility instead. The following issue is explaining this in more details. Please feel free to chime in and give us more information in that issue. Thanks!

Thanks for the swift reply. I will add a comment to the issue for further discussion.

1 Like