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

Bit export fails due to auth issue #2211

Closed
AlexanderKaran opened this issue Dec 23, 2019 · 22 comments · Fixed by #2309
Closed

Bit export fails due to auth issue #2211

AlexanderKaran opened this issue Dec 23, 2019 · 22 comments · Fixed by #2309

Comments

@AlexanderKaran
Copy link

When tag multiple components and then running

bit export

I get an error if any of my components being exported include a bit package from the bit library itself.

error: permission to scope hub.bit.dev:react-bootstrap.react-bootstrap was denied see troubleshooting at https://docs.bit.dev/docs/setup-authentication#authentication-issues

A few of the components that are causing issues include a component or two from this library

https://bit.dev/react-bootstrap/react-bootstrap

When exporting and tagging components one by one I do not get the issue, only when doing multiple exports, which really slows things down.

Specifications

  • Bit version: 14.7.1
  • Node version: 13.3.0
  • npm / yarn version: 6.13.2
  • Platform: Mac
  • Bit compiler (include version): React
  • Bit tester (include version):

Additional context

Add any other context about the problem here.

@GiladShoham
Copy link
Member

hello,
Did you run bit export without any args?
If yes, it will by default try to export the components to the scope they were imported from.
I guess you don't have permission to the react-bootstrap scope so when trying to export back to this scope you get the error.
You can either run
bit export user.collection which will export all the staged components to this collection.
or use the --set-current-scope when exporting components that imported from scope you don't own to change their current scope, so next time you will run bit export without any args it will export them to this scope.
read more about it here

If the description above doesn't describe your situation / solve your issue, please re-open.
At the moment it looks like it's the expected behavior.

@Tallyb I think it's worth writing a few words about what happens when running bit export without any arg.

@AlexanderKaran
Copy link
Author

Thanks for the info @GiladShoham

Question though, what happens when I have updated multiple components from different scopes, what argument do I need to add to export all to their collections?

@AlexanderKaran
Copy link
Author

AlexanderKaran commented Dec 24, 2019

Also, why is trying to export to the Bootstrap collection when I have not tagged changes in it because it is not my component.

@GiladShoham
Copy link
Member

Question though, what happens when I have updated multiple components from different scopes, what argument do I need to add to export all to their collections?

The implicit bit export (without any args) are designed for this exactly. so you can run bit export and everything goes back to where it belongs.
The issue start when you tag components that doesn't belongs to you and trying to export them back to their original collection when what you really want it to fork them into your own collection.
In such case I would recommend to first export them manually (can be grouped by bit export user.collection forkedComp1 forkedComp2)
then run the regular bit export without args from now on.

Also, why is trying to export to the Bootstrap collection when I have not tagged changes in it because it is not my component.

If you didn't tag them, it's really odd. it might be a bug.
What do you see in bit status before the export?

@AlexanderKaran
Copy link
Author

Yes, I did not tag them, it's a bug. I will run it again tomorrow and re-open this issue with all the details.

@GiladShoham
Copy link
Member

@AlexanderKaran
Thanks.

@AlexanderKaran
Copy link
Author

AlexanderKaran commented Jan 7, 2020

Hi @GiladShoham

So I had a who load of updates and I ran:

bit tag --all

I did not tag the third-party component from Bootstrap at all

I then run:

bit export

And I get the auth error even though I did not change the Bootstrap component:

error: permission to scope hub.bit.dev:react-bootstrap.react-bootstrap was denied
see troubleshooting at https://docs.bit.dev/docs/setup-authentication#authentication-issues

Here is my terminal print out:

alexanderkaran@AlexandersMBP2 cc_school_web % bit tag --all
  building components...
⢀⠀ building component - climateclever.measure-page-components/[email protected](node:9023) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
✔ building component - climateclever.measure-page-components/[email protected]
✔ building component - climateclever.redux-components/[email protected]
✔ building component - climateclever.redux-components/[email protected]
✔ building component - climateclever.ui-components/[email protected]
✔ building component - climateclever.ui-components/[email protected]
✔ building component - climateclever.ui-components/[email protected]
✔ building component - climateclever.ui-components/[email protected]
✔ building component - climateclever.ui-components/[email protected]
✔ building component - climateclever.ui-components/[email protected]
✔ building component - climateclever.ui-icons/[email protected]
✔ building component - climateclever.web-networking/[email protected]
✔ building component - climateclever.dashboard-page-components/[email protected]
✔ building component - climateclever.dashboard-page-components/[email protected]
✔ building component - climateclever.forgot-change-page-components/[email protected]
✔ building component - climateclever.forgot-page-components/[email protected]
✔ building component - climateclever.login-page-components/[email protected]
✔ building component - climateclever.measure-page-components/[email protected]
✔ building component - climateclever.measure-page-components/[email protected]
✔ building component - climateclever.profile-page-components/[email protected]
✔ building component - climateclever.profile-page-components/[email protected]
✔ building component - climateclever.set-first-password-page-components/[email protected]
✔ building component - climateclever.signup-page-components/[email protected]
✔ building component - climateclever.ui-components/[email protected]
✔ building component - climateclever.ui-components/[email protected]
✔ building component - climateclever.ui-components/[email protected]
✔ building component - climateclever.ui-components/[email protected]
✔ building component - climateclever.ui-components/[email protected]
✔ building component - climateclever.ui-components/[email protected]
✔ building component - climateclever.ui-components/[email protected]
✔ building component - climateclever.ui-components/[email protected]
✔ building component - climateclever.ui-components/[email protected]
✔ building component - climateclever.ui-components/[email protected]
✔ building component - climateclever.ui-components/[email protected]
✔ building component - climateclever.ui-components/[email protected]
✔ building component - climateclever.ui-components/[email protected]
✔ building component - climateclever.ui-components/[email protected]
✔ building component - climateclever.ui-components/[email protected]
37 component(s) tagged
(use "bit export [collection]" to push these components to a remote")
(use "bit untag" to unstage versions)

changed components
(components that got a version bump)
     > climateclever.measure-page-components/[email protected]
       auto-tagged dependents: climateclever.measure-page-components/[email protected]
     > climateclever.redux-components/[email protected]
     > climateclever.redux-components/[email protected]
     > climateclever.ui-components/[email protected]
       auto-tagged dependents: climateclever.dashboard-page-components/[email protected], climateclever.dashboard-page-components/[email protected], climateclever.forgot-change-page-components/[email protected], climateclever.forgot-page-components/[email protected], climateclever.login-page-components/[email protected], climateclever.profile-page-components/[email protected], climateclever.profile-page-components/[email protected], climateclever.set-first-password-page-components/[email protected], climateclever.signup-page-components/[email protected], climateclever.ui-components/[email protected], climateclever.ui-components/[email protected], climateclever.ui-components/[email protected], climateclever.ui-components/[email protected], climateclever.ui-components/[email protected], climateclever.ui-components/[email protected], climateclever.ui-components/[email protected], climateclever.ui-components/[email protected], climateclever.ui-components/[email protected], climateclever.ui-components/[email protected]
     > climateclever.ui-components/[email protected]
       auto-tagged dependents: climateclever.profile-page-components/[email protected], climateclever.signup-page-components/[email protected]
     > climateclever.ui-components/[email protected]
     > climateclever.ui-components/[email protected]
       auto-tagged dependents: climateclever.forgot-change-page-components/[email protected], climateclever.forgot-page-components/[email protected], climateclever.login-page-components/[email protected], climateclever.profile-page-components/[email protected], climateclever.set-first-password-page-components/[email protected], climateclever.signup-page-components/[email protected]
     > climateclever.ui-components/[email protected]
     > climateclever.ui-components/[email protected]
       auto-tagged dependents: climateclever.forgot-change-page-components/[email protected], climateclever.forgot-page-components/[email protected], climateclever.login-page-components/[email protected], climateclever.profile-page-components/[email protected], climateclever.profile-page-components/[email protected], climateclever.set-first-password-page-components/[email protected], climateclever.signup-page-components/[email protected], climateclever.ui-components/[email protected], climateclever.ui-components/[email protected], climateclever.ui-components/[email protected], climateclever.ui-components/[email protected], climateclever.ui-components/[email protected], climateclever.ui-components/[email protected]
     > climateclever.ui-icons/[email protected]
       auto-tagged dependents: climateclever.measure-page-components/[email protected], climateclever.measure-page-components/[email protected]
     > climateclever.web-networking/[email protected]

alexanderkaran@AlexandersMBP2 cc_school_web % bit export
error: permission to scope hub.bit.dev:react-bootstrap.react-bootstrap was denied
see troubleshooting at https://docs.bit.dev/docs/setup-authentication#authentication-issues
alexanderkaran@AlexandersMBP2 cc_school_web % 

Here is my bit status:

`alexanderkaran@AlexandersMBP2 cc_school_web % bit status
staged components
(use "bit export <remote_scope> to push these components to a remote scope")

 > section. versions: 0.0.8 ... ok
 > section-cards. versions: 0.0.8 ... ok
 > forgot-change-form. versions: 0.0.10 ... ok
 > forgot-form. versions: 0.0.10 ... ok
 > login-form. versions: 0.0.12 ... ok
 > measure-stats. versions: 0.0.7 ... ok
 > progress. versions: 0.0.2 ... ok
 > account-page. versions: 0.0.10 ... ok
 > payment-info. versions: 0.0.7 ... ok
 > provider-actions. versions: 0.0.2 ... ok
 > providers-reducer. versions: 0.0.2 ... ok
 > set-first-password-form. versions: 0.0.9 ... ok
 > default-user-sign-up-form. versions: 0.0.15 ... ok
 > cc-alert. versions: 0.0.5 ... ok
 > cc-app-error. versions: 0.0.2 ... ok
 > cc-area-card. versions: 0.0.5 ... ok
 > cc-bottom-bar-alert. versions: 0.0.4 ... ok
 > cc-button. versions: 0.0.6 ... ok
 > cc-button-loader. versions: 0.0.7 ... ok
 > cc-drop-down-input. versions: 0.0.4 ... ok
 > cc-drop-down-input-formix. versions: 0.0.5 ... ok
 > cc-formix-input-group. versions: 0.0.4 ... ok
 > cc-full-page-alert. versions: 0.0.6 ... ok
 > cc-input-label-link. versions: 0.0.6 ... ok
 > cc-modal. versions: 0.0.6 ... ok
 > cc-panel. versions: 0.0.3 ... ok
 > cc-panel-actions. versions: 0.0.2 ... ok
 > cc-payment-details. versions: 0.0.9 ... ok
 > cc-search-bar. versions: 0.0.2 ... ok
 > cc-text-input. versions: 0.0.2 ... ok
 > cc-text-input-address. versions: 0.0.5 ... ok
 > cc-text-input-password. versions: 0.0.3 ... ok
 > cc-text-input-phone. versions: 0.0.2 ... ok
 > cc-text-input-year. versions: 0.0.2 ... ok
 > circle-arrow-icon. versions: 0.0.2 ... ok
 > products. versions: 0.0.2 ... ok

`

@AlexanderKaran
Copy link
Author

I have managed to export most by exporting each component one by one.

However, now I am left with a few that won't export because apparently the ID is wrong even though I am copying what comes from bit status. Also bit export still has the auth issue.

alexanderkaran@AlexandersMBP2 cc_school_web % bit status
staged components
(use "bit export <remote_scope> to push these components to a remote scope")

     > login-form. versions: 0.0.13 ... ok
     > measure-stats. versions: 0.0.7 ... ok
     > payment-info. versions: 0.0.7 ... ok
     > cc-modal. versions: 0.0.6 ... ok
alexanderkaran@AlexandersMBP2 cc_school_web % bit export climateclever.measure-page-components measure-stats
error: component ID is invalid, please use the following format: [scope]/<name>

@GiladShoham
Copy link
Member

@AleksandarSavic95 Thanks for reporting this.
The issue with the id is a bug, we will fix it.
you can try to export it with the full name:
bit export climateclever.measure-page-components climateclever.measure-page-components /measure-stats
It should do the trick.

@GiladShoham GiladShoham reopened this Jan 7, 2020
@AlexanderKaran
Copy link
Author

Any update on this? It really slowing dev down having to export components one by one?

@davidfirst
Copy link
Member

@AlexanderKaran , Can you think of a way for me to reproduce the issue?
If not, let's start with understanding where this react-bootstrap comes from.
Please run bit list --scope, find a component that starts with react-bootstrap, then, run bit show <id-you-found> --dependents --dependencies, let me know if you see any of your components there.
If there is only one react-bootstrap, please run bit cmp <id> and see if there is any 'local' or 'state' property.

Until this is fixed, you can use wildcards to avoid exporting them one by one.
e.g. bit export climateclever.ui-components climateclever.ui-components/*, this will export all components start with climateclever.ui-components to climateclever.ui-components remote.

@AlexanderKaran
Copy link
Author

@davidfirst Thanks for the wild card update, maybe we can update the docs so they are a little clearer with these things.

react-bootstrap comes from here:

https://bit.dev/react-bootstrap/react-bootstrap/container

We never update it, change it or anything else. It's installed via NPM and used in a few of our Bit components. Will run those commands when I get to the office.

@AlexanderKaran
Copy link
Author

Also, I ran:

bit export climateclever.ui-components climateclever.ui-components/*

And it states:

zsh: no matches found: ui-components/*

When there are this many components to export like this:

(use "bit export <remote_scope> to push these components to a remote scope")

 > action-selection. versions: 0.0.3 ... ok
 > header-stats-and-actions. versions: 0.0.3 ... ok
 > section. versions: 0.0.9 ... ok
 > section-cards. versions: 0.0.9 ... ok
 > forgot-change-form. versions: 0.0.14 ... ok
 > forgot-form. versions: 0.0.14 ... ok
 > login-form. versions: 0.0.17 ... ok
 > measure-stats. versions: 0.0.10 ... ok
 > account-page. versions: 0.0.14 ... ok
 > payment-info. versions: 0.0.12 ... ok
 > profile-menu. versions: 0.0.3 ... ok
 > set-first-password-form. versions: 0.0.13 ... ok
 > default-user-sign-up-form. versions: 0.0.19 ... ok
 > payment-plans. versions: 0.0.3 ... ok
 > price-info. versions: 0.0.5 ... ok
 > terms. versions: 0.0.5 ... ok
 > cc-alert. versions: 0.0.6 ... ok
 > cc-app-error. versions: 0.0.3 ... ok
 > cc-area-card. versions: 0.0.6 ... ok
 > cc-bottom-bar-alert. versions: 0.0.7 ... ok
 > cc-button. versions: 0.0.7 ... ok
 > cc-button-loader. versions: 0.0.10 ... ok
 > cc-check-box. versions: 0.0.5 ... ok
 > cc-date-selector. versions: 0.0.2 ... ok
 > cc-date-selector-formik. versions: 0.0.3 ... ok
 > cc-drop-down-input. versions: 0.0.5 ... ok
 > cc-drop-down-input-formix. versions: 0.0.7 ... ok
 > cc-formix-input-group. versions: 0.0.7 ... ok
 > cc-full-page-alert. versions: 0.0.7 ... ok
 > cc-header. versions: 0.0.4 ... ok
 > cc-icon-bar. versions: 0.0.2 ... ok
 > cc-input-label-link. versions: 0.0.7 ... ok
 > cc-modal. versions: 0.0.7 ... ok
 > cc-panel. versions: 0.0.7 ... ok
 > cc-panel-actions. versions: 0.0.6 ... ok
 > cc-payment-details. versions: 0.0.13 ... ok
 > cc-search-bar. versions: 0.0.4 ... ok
 > cc-tab-menu. versions: 0.0.2 ... ok
 > cc-table. versions: 0.0.2 ... ok
 > cc-table-icons. versions: 0.0.2 ... ok
 > cc-text-input. versions: 0.0.4 ... ok
 > cc-text-input-address. versions: 0.0.8 ... ok
 > cc-text-input-password. versions: 0.0.5 ... ok
 > cc-text-input-phone. versions: 0.0.4 ... ok
 > cc-text-input-year. versions: 0.0.4 ... ok
 > cc-toggle-input. versions: 0.0.7 ... ok
 > cc-triangle. versions: 0.0.2 ... ok
 > billing-setup. versions: 0.0.2 ... ok
 > cru-bill. versions: 0.0.5 ... ok
 > cru-meter. versions: 0.0.4 ... ok
 > cru-provider. versions: 0.0.6 ... ok
 > cru-stream. versions: 0.0.4 ... ok
 > cru-volume. versions: 0.0.4 ... ok
 > cru-waste-bill. versions: 0.0.5 ... ok
 > cru-weight. versions: 0.0.4 ... ok
 > providers. versions: 0.0.6 ... ok
 > set-up. versions: 0.0.5 ... ok
 > type-selection-row. versions: 0.0.2 ... ok
 > utilities-components/bills. versions: 0.0.6 ... ok
 > utility-header-nav. versions: 0.0.2 ... ok

Everyone starting with cc- is ui-components/*

@Tallyb
Copy link
Contributor

Tallyb commented Jan 14, 2020

@AlexanderKaran add quotes:

bit export climateclever.ui-components "climateclever.ui-components/*"

This is because zsh is trying to interpret the asterisk.
Also - was updated in the docs: https://docs.bit.dev/docs/export#remote-scopes

@AlexanderKaran
Copy link
Author

Thank you @Tallyb

@GiladShoham
Copy link
Member

@AlexanderKaran Did what @Tallyb suggested worked as expected?

@AlexanderKaran
Copy link
Author

@GiladShoham Yes it did, export each collection one by one causes no errors, only on export all do I get the error

@davidfirst
Copy link
Member

@AlexanderKaran , if you're still experiencing this issue, please run the following BIT_LOG=debug bit export, it'll print the log during the export command. Copy the output and send it to me by email to [email protected].

@AlexanderKaran
Copy link
Author

Sure, will do this today @davidfirst

@AlexanderKaran
Copy link
Author

Email sent, sorry for the slow reply some other priorities took over

@davidfirst davidfirst self-assigned this Feb 6, 2020
@davidfirst
Copy link
Member

Good news! I'm able to reproduce the issue. Working on a fix now.

davidfirst added a commit that referenced this issue Feb 6, 2020
…not export their dependencies when these dependencies themselves are not export pending
davidfirst added a commit that referenced this issue Feb 6, 2020
…not export their dependencies when these dependencies themselves are not export pending (#2309)
@davidfirst
Copy link
Member

The issue has been fixed by the PR above.

GiladShoham added a commit that referenced this issue Feb 9, 2020
* fix #2211 and #2308, when exporting to multiple scopes, make sure to not export their dependencies when these dependencies themselves are not export pending (#2309)

* resolve #2268, prevent logger from holding the terminal once a command is completed by adding an error handler. Also, changed some "logger.debug" to "logger.silly". Also, support configuring the logger level by running "bit config set log_level <level>". Also, limit the number of concurrent files write to 100 (#2310)

* fix typo in the BitId README

* fix "bit status" and "bit tag" when new components require each other by module paths (#2313)

Co-authored-by: David First <[email protected]>
davidfirst added a commit that referenced this issue Feb 17, 2020
* fix #2211 and #2308, when exporting to multiple scopes, make sure to not export their dependencies when these dependencies themselves are not export pending (#2309)

* bump dev version

* resolve #2268, prevent logger from holding the terminal once a command is completed by adding an error handler. Also, changed some "logger.debug" to "logger.silly". Also, support configuring the logger level by running "bit config set log_level <level>". Also, limit the number of concurrent files write to 100 (#2310)

* fix typo in the BitId README

* fix "bit status" and "bit tag" when new components require each other by module paths (#2313)

* Fix e2e-tests to avoid code execution inside "describe" blocks (#2329)

* move all Helper instantiation from describe to before.
* fix defaultScope tests, remove code that was entered by mistake in the describe block to before block.
* delete javascript-hook.e2e file, the tests there were written long ago, marked as "skip" and not relevant anymore.

* support import/require statements of module paths when it has no scope-name (e.g. "@bit/button") (#2331)

* resolve part of #2341, enable "--all" flag when "--all-versions" is used and vice versa, to enable re-exporting a component after deleting it (#2345)

* Fixed broken link leading to quick start guide (#2338)

* fix dynamic dist reference from package.json (#1808) when isolating via capsule (#2348)

* remove .only from extension tests

Co-authored-by: Erik <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants