ENV variables not being set either in config file or using --env flag in cli
See original GitHub issueHi there,
I’m having trouble with environment variables, seems like adding them in cypress.config.js or using --env cli does not register them in cypress. When I inspect the settings in the UI or print the env vars during tests I see the following.

If I use cypress.env.json
, it registers my variables but it also shows the same error.

Versions
- Cypress version: 10.9.0
- Preprocessor version: 13.0.2
- Node version: 18.9.1
my cypress.config.js
file looks like this:
const { defineConfig } = require("cypress");
const createBundler = require("@bahmutov/cypress-esbuild-preprocessor");
const addCucumberPreprocessorPlugin =
require("@badeball/cypress-cucumber-preprocessor").addCucumberPreprocessorPlugin;
const createEsbuildPlugin =
require("@badeball/cypress-cucumber-preprocessor/esbuild").createEsbuildPlugin;
require('dotenv').config({path: './.env'});
module.exports = defineConfig({
e2e: {
async setupNodeEvents(on, config) {
const bundler = createBundler({
plugins: [createEsbuildPlugin(config)],
});
on("file:preprocessor", bundler);
await addCucumberPreprocessorPlugin(on, config);
return config;
},
specPattern: "cypress/e2e/features/*.feature",
chromeWebSecurity: false,
},
});
my package.json
contains the following:
"cypress-cucumber-preprocessor": {
"stepDefinitions": "./cypress/e2e/step_definitions/*.cy.js"
}
Checklist
- I’ve read the FAQ.
- I’ve read Instructions for logging issues.
- I’m not using
cypress-cucumber-preprocessor@4.3.1
(package name has changed and it is no longer the most recent version, see #689).
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
SAM deploy doesn't set environment variables #1163 - GitHub
I get "unable to use container host config override file from '$HOME/.config/aws-sam-local/container-config.json': HOME env variable is not set" ...
Read more >Don't use environment variables for configuration | Hacker News
So either a file that's outside of version control with variables you set per environment or actual server environment variables.
Read more >Setting environment variable in react-native? - Stack Overflow
Works for me in v0. 56. You have to clear bundler's cache by running react-native start --reset-cache every time you change the environment...
Read more >Pass Docker Environment Variables During The Image Build
Looking for a way to set pass environment variables during your Docker image build ... the image build with --build-arg , but there...
Read more >Environment variables to configure the AWS CLI
The AWS CLI supports the following environment variables. Specifies an AWS access key associated with an IAM user or role. If defined, this...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It’s not an error, but something set by the plugin and not something you need to be concerned about.
Great! so that works, but still seeing the error message too. Any idea what that is?