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

Environment variables get applied as options to any command #793

Open
wagnerand opened this issue Feb 7, 2017 · 10 comments

Comments

6 participants
@wagnerand
Copy link
Member

commented Feb 7, 2017

Is this a bug or feature request?

This is a bug.

What is the current behavior?

I have set WEB_EXT_API_KEY and WEB_EXT_API_SECRET in my ~/.bash_profile.
Running web-ext build for any webextension project fails with the following error:
Unknown arguments: apiSecret, apiKey
When I remove the two environment variables, web-ext works fine.

What is the expected or desired behavior?

web-ext build (and other commands) should ignore environment variables they don't need.

Version information (for bug reports)

  • Firefox version: irrelevant
  • Your OS and version: MacOS 1.12.3
  • Paste the output of these commands:
node --version && npm --version && web-ext --version

v7.5.0
4.1.2
1.6.0

@kumar303 kumar303 added the type: bug label Feb 7, 2017

@kumar303

This comment has been minimized.

Copy link
Member

commented Feb 7, 2017

oof, good catch. I'm pretty sure this has existed ever since #226 but no one else noticed. It's because those env variables are only recognized by the sign command. For other commands, our parser thinks they are env vars for unknown options.

@eight04

This comment has been minimized.

Copy link
Contributor

commented Apr 30, 2017

This make environment variable totally unusable... and it seems that web-ext use yargs to parse env variable (https://github.com/mozilla/web-ext/blob/master/src/program.js#L88). Should we move this to yargs or any other ideas to fix this?

@kumar303

This comment has been minimized.

Copy link
Member

commented May 2, 2017

Oops, I should have filed an upstream bug originally. Here it is: yargs/yargs#873

bfred-it added a commit to npmhub/npmhub that referenced this issue May 20, 2017

@kumar303 kumar303 changed the title web-ext build fails when WEB_EXT_API_KEY is set Environment variables get applied as options to any command Aug 2, 2017

@stephenmathieson

This comment has been minimized.

Copy link

commented Sep 19, 2018

Any updates here? I just killed over an hour trying to figure this out.


Hack I'm using to work-around this for now:

APIKEY="$WEB_EXT_API_KEY"
APISECRET="$WEB_EXT_API_SECRET"
unset WEB_EXT_API_KEY
unset WEB_EXT_API_SECRET

# Zip the Firefox extension.
npx web-ext build --config-discovery=false

# Zip+sign (XPI) the Firefox extension.
npx web-ext sign \
  --api-key=$APIKEY \
  --api-secret=$APISECRET \
  --config-discovery=false
@Rob--W

This comment has been minimized.

Copy link
Member

commented Sep 19, 2018

No updates yet. I have planned a patch to upgrade our yargs dependency to resolve some issues ( #1307 and #1327 in particular). That might or might not fix this issue.
Regardless, you should be able to set the key and secret in the config file once #1327 is resolved.

@stephenmathieson

This comment has been minimized.

Copy link

commented Sep 19, 2018

I'm creating these archives on CI and want to use environment variables rather than having to worry about creating a config file.

Do you have an estimate as to when the yargs dep will be updated?

@Rob--W

This comment has been minimized.

Copy link
Member

commented Sep 19, 2018

Not soon, unfortunately. I ran in multiple issues when I tried to upgrade and have other higher pressing tasks that I need to work on.

@stephenmathieson

This comment has been minimized.

Copy link

commented Sep 19, 2018

OK, fair enough.

Perhaps adding something to the README and/or https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/web-ext_command_reference would suffice for now?

@kumar303

This comment has been minimized.

@Rob--W Rob--W added this to Todo in 3.0.0 via automation Oct 25, 2018

@rpl rpl added this to To do in 3.1.0 via automation Feb 22, 2019

@rpl rpl removed this from Todo in 3.0.0 Feb 22, 2019

@Fedcomp

This comment has been minimized.

Copy link

commented Jun 20, 2019

wow, middle of 2019 and still not fixed

@rpl rpl removed this from To do in 3.1.0 Jul 1, 2019

@rpl rpl added this to To do in 3.2.0 Jul 1, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.