n4bb12 / verdaccio-github-oauth-ui

📦🔐 GitHub OAuth plugin for Verdaccio
https://verdaccio.org
MIT License
74 stars 45 forks source link

`plugin not found` with version 2.3.1 #54

Closed lauraseidler closed 4 years ago

lauraseidler commented 4 years ago

Bug Report

Versions

Version
verdaccio 4.7.2
verdaccio-github-oauth-ui 2.3.1

Expected behavior

Verdaccio starts up with the plugin enabled.

Observed behaviour

Verdaccio crashes on startup because the plugin cannot be found.

Steps to reproduce

  1. Install verdaccio and this plugin in version 2.3.1
  2. Configure verdaccio to use the plugin
  3. Start verdaccio
  4. Error: plugin not found. try npm install verdaccio-github-oauth-ui

If instead version 2.3.0 or below is installed, there is no issue.

Additional context

You can use the following minimal Dockerfile and config.yaml to reproduce the problem.

FROM verdaccio/verdaccio:4.7.2

USER root

RUN yarn add verdaccio-github-oauth-ui@2.3.1 # 2.3.0 works fine
COPY config.yaml /verdaccio/conf/config.yaml

USER verdaccio
storage: /verdaccio/storage/data
plugins: /verdaccio/plugins

web:
  title: Verdaccio

packages:
  '**':
    access: $all
    publish: $authenticated
    unpublish: $authenticated

middlewares:
  github-oauth-ui:
    enabled: true
n4bb12 commented 4 years ago

Thanks for the detailed description 🙏

n4bb12 commented 4 years ago

I tried running Verdaccio with your config and got this error instead:

error loading a plugin github-oauth-ui: Error: "auth.github-oauth-ui" must be enabled

This block seems to be missing in your config but it is required for the plugin to be able to work

auth:
  github-oauth-ui:
    org: GITHUB_ORG
    client-id: GITHUB_CLIENT_ID
    client-secret: GITHUB_CLIENT_SECRET

Could you have a look if you have this in your real config, since it's missing in the issue description?

lauraseidler commented 4 years ago

Yeah I have this in the real config - I removed everything from the config that still got me the plugin not found error on initial startup - full config looks like this (minus comments and private package configuration):

---
storage: /verdaccio/storage/data
plugins: /verdaccio/plugins

web:
  title: Verdaccio

auth:
  htpasswd:
    file: /verdaccio/storage/htpasswd
  github-oauth-ui:
    org: GITHUB_ORG
    client-id: GITHUB_CLIENT_ID
    client-secret: GITHUB_CLIENT_SECRET

uplinks:
  npmjs:
    url: https://registry.npmjs.org/

packages:
  "**":
    access: $authenticated
    publish: $authenticated
    unpublish: $authenticated
    proxy: npmjs

middlewares:
  audit:
    enabled: true
  github-oauth-ui:
    enabled: GITHUB_ENABLED

logs:
  - { type: stdout, format: pretty, level: http }
n4bb12 commented 4 years ago

Ah, I had replaced some custom code for query-string and placed it in dev-dependencies instead of dependencies. This prevented the plugin from loading.

n4bb12 commented 4 years ago

Fixed in https://github.com/n4bb12/verdaccio-github-oauth-ui/releases/tag/2.3.2

Thanks again for reporting and for the good info 👍

lauraseidler commented 4 years ago

Fantastic, thanks for the quick fix!