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

Fern CLI shouldn't require login #2003

Open
dsinghvi opened this issue Aug 3, 2023 · 12 comments
Open

Fern CLI shouldn't require login #2003

dsinghvi opened this issue Aug 3, 2023 · 12 comments
Labels
config Configuration within your fern folder product/CLI Fern's command line interface tool

Comments

@dsinghvi
Copy link
Member

dsinghvi commented Aug 3, 2023

Fern requires login to generate code, which prevents usage in large open source repos where there may be several contributors or in organizations that don't want to share information/rely on our servers.

Why did we require login?

  1. Identify verification: If you want to publish your SDK to a registry (e.g. npm.buildwithfern.com), mirror code to Github or generate a docs website then Fern needs to make sure that you are indeed the person that is allowed to publish to that location.
  2. Support: If a user runs into an error, we are easily able to reach out and help them troubleshoot.

Proposal: Don't require login when generating code locally

Fern supports an entirely local mode to generate code where we spin up the generator as a docker and output files to disk. There's no reason to require login for this mode.

If you do fern add <generator> --mode docker or add the mode: docker field to your generator, then fern will run locally and not require login.

groups: 
  server: 
    - name: fernapi/fern-fastapi-server
       version: 0.3.8
       mode: docker # <-------------
       output: 
         location: local-file-system
         path: ../a/bc

Note that if the mode is docker but the output is npm or pypi, then the CLI will throw an error.

With this command we will also deprecate fern generate --local

@SebastianStehle
Copy link

I don't get the first point. How do you verify that the NPM token is from me.

@dsinghvi
Copy link
Member Author

dsinghvi commented Aug 3, 2023

I don't get the first point. How do you verify that the NPM token is from me.

There are folks that will publish private packages to npm.buildwithfern.com. We need to verify that not anyone can publish over their packages. (For npmjs you are right)

Similarly, there are folks that use fern's github app to publish to a specific Github repo and we need to make sure that not anyone can publish to that github repo.

The same goes with docs -- if a user publishes to mycompany.docs.buildwithfern.com we need to make sure noone else can come and publish.

@SebastianStehle
Copy link

Sure, but were is the difference between a npm token and a fern token? If it is needed for an action you have to add the token, otherwise not. There might be even 2 tokens for your 2 services.

@kiikoh
Copy link

kiikoh commented Aug 3, 2023

Why is docker needed?

@aevitas
Copy link
Contributor

aevitas commented Aug 3, 2023

Why is docker needed?

Because the generators are written in the language they produce, and requiring a fully fledged development environments for each language is less ideal than simply running the generator in a container.

@dsinghvi
Copy link
Member Author

dsinghvi commented Aug 3, 2023

+1. At some point we will support mode: native where you can just run the generators as a CLI so the python generator may require python 3.7 being present, the typescript one may require node v18, etc.

That is not going to be something we support in the next 3 months so docker will be the only way to run the generators locally.

@cgddrd-gardin
Copy link

As I understand, the current enforcement of fern login makes it impossible to integrate fern as part of a CICD pipeline (e.g. Github Actions)?

If so, this is a massive problem for us.

@aevitas
Copy link
Contributor

aevitas commented Sep 6, 2023

As I understand, the current enforcement of fern login makes it impossible to integrate fern as part of a CICD pipeline (e.g. Github Actions)?

If so, this is a massive problem for us.

You can also use a Fern token instead of logging in, allowing you to use it in your pipelines. @dsinghvi can help you get one.

@cgddrd-gardin
Copy link

As I understand, the current enforcement of fern login makes it impossible to integrate fern as part of a CICD pipeline (e.g. Github Actions)?
If so, this is a massive problem for us.

You can also use a Fern token instead of logging in, allowing you to use it in your pipelines. @dsinghvi can help you get one.

That would be super useful!

@dsinghvi
Copy link
Member Author

dsinghvi commented Sep 6, 2023

As I understand, the current enforcement of fern login makes it impossible to integrate fern as part of a CICD pipeline (e.g. Github Actions)?
If so, this is a massive problem for us.

You can also use a Fern token instead of logging in, allowing you to use it in your pipelines. @dsinghvi can help you get one.

That would be super useful!

@cgddrd-gardin if you join our discord i can send you a fern token! or you can email me at deep@buildwithfern.com!

@dsinghvi dsinghvi removed the cli label Nov 6, 2023
@dannysheridan dannysheridan changed the title Fern CLI shouldn't require login [Feature] Fern CLI shouldn't require login Jan 22, 2024
@dannysheridan dannysheridan added the config Configuration within your fern folder label Jan 22, 2024
@Danwakeem
Copy link
Contributor

I had the same question and apparently you can generate a fern token via the CLI. Here are the docs for this 😎

@sidpan1
Copy link

sidpan1 commented Mar 13, 2024

What if I just need to use the open source version for generating clients. Why do I need to login to do that?

Login should be optional for folks who want to use your cloud product.

@dannysheridan dannysheridan changed the title [Feature] Fern CLI shouldn't require login Fern CLI shouldn't require login Nov 24, 2024
@dannysheridan dannysheridan added the product/CLI Fern's command line interface tool label Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config Configuration within your fern folder product/CLI Fern's command line interface tool
Development

No branches or pull requests

8 participants