Skip to content

Error: Input required and not supplied: token #31

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

Closed
lastdoctor opened this issue Jan 31, 2021 · 7 comments
Closed

Error: Input required and not supplied: token #31

lastdoctor opened this issue Jan 31, 2021 · 7 comments
Labels
question Further information is requested

Comments

@lastdoctor
Copy link

lastdoctor commented Jan 31, 2021

Hi, I have problem
npm-publish.yml
`on: push

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 10
- run: npm install
- run: npm test
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}`

and Here I have problem
Run JS-DevTools/npm-publish@v1 with: registry: https://registry.npmjs.org/ package: package.json tag: latest dry-run: false check-version: true Error: Error: Input required and not supplied: token at Object.getInput (/home/runner/work/_actions/JS-DevTools/npm-publish/v1/node_modules/@actions/core/lib/core.js:94:1) at main (/home/runner/work/_actions/JS-DevTools/npm-publish/v1/src/action/index.ts:17:14) at Object.48 (/home/runner/work/_actions/JS-DevTools/npm-publish/v1/src/action/index.ts:74:1) at __webpack_require__ (/webpack/bootstrap:21:1) at startup (/webpack/bootstrap:40:1) at /webpack/bootstrap:44:1 at Object.<anonymous> (/home/runner/work/_actions/JS-DevTools/npm-publish/v1/dist/index.js:50:10) at Module._compile (internal/modules/cjs/loader.js:959:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10) at Module.load (internal/modules/cjs/loader.js:815:32)

@trivikr
Copy link

trivikr commented Apr 8, 2021

I'm receiving the same error.

Failed GitHub Action for reference: https://github.com/trivikr/test-postinstall-node-version-check/actions/runs/727995782

Error:

Error: Error: Input required and not supplied: token
    at Object.getInput (/home/runner/work/_actions/JS-DevTools/npm-publish/v1/node_modules/@actions/core/lib/core.js:94:1)
    at main (/home/runner/work/_actions/JS-DevTools/npm-publish/v1/src/action/index.ts:17:14)
    at Object.48 (/home/runner/work/_actions/JS-DevTools/npm-publish/v1/src/action/index.ts:74:1)
    at __webpack_require__ (/webpack/bootstrap:21:1)
    at startup (/webpack/bootstrap:40:1)
    at /webpack/bootstrap:44:1
    at Object.<anonymous> (/home/runner/work/_actions/JS-DevTools/npm-publish/v1/dist/index.js:50:10)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)

Configuration for reference:

name: push

on:
  push:
    branches: [main]

jobs:
  publish:
    runs-on: ubuntu-latest
    if: github.event_name == 'push' && github.ref == 'refs/heads/main'
    steps:
      - uses: actions/checkout@v2
      - uses: JS-DevTools/npm-publish@v1
        env:
          token: ${{ secrets.NPM_AUTH_TOKEN }}

I verified that NPM_AUTH_TOKEN GitHub secret is present, as the same secret was successfully used by https://github.com/marketplace/actions/automated-releases-for-npm-packages prior to testing npm-publish

trivikr added a commit to trivikr/test-postinstall-node-version-check that referenced this issue Apr 8, 2021
Link: https://github.com/marketplace/actions/publish-to-npm

npm-publish is throwing error "Input required and not supplied: token"
Refs: JS-DevTools/npm-publish#31
@ayush-goyal
Copy link

I'm having this same issue as well ^

@Nurutomo
Copy link

same error with this configuration

name: npm-publish
on: "workflow_dispatch"
jobs:
  npm-publish:
    name: npm-publish
    runs-on: ubuntu-latest
    steps:
    - name: Checkout repository
      uses: actions/checkout@master
    - name: Set up Node.js
      uses: actions/setup-node@master
      with:
        node-version: 14.0.0
    - id: publish
      uses: JS-DevTools/npm-publish@v1
      with:
        token: ${{ secrets.NPM_TOKEN }}

The Error Log:
https://github.com/Nurutomo/xteam-api/runs/2812373560?check_suite_focus=true

@thegiantbeast
Copy link

thegiantbeast commented Mar 15, 2022

The workaround I found to work is to run env as a step before this action. Like so:

    - name: List Github Actions
       run: env
    - uses: JS-DevTools/npm-publish@v1
      with:
        token: ${{ secrets.NPM_TOKEN }}

It seems there's some race condition where the action tries to read process.env, but the variables were not yet set up? 🤔
It sounds weird this explanation, but it's the closest thing I can think about

UPDATE: I was wrong, this didn't actually workaround the issue but strange given that I tried a couple of times to be sure it wasn't a false positive. 🤔

@thegiantbeast
Copy link

@JamesMessinger any thoughts on this one? 🙇

@OskarDamkjaer
Copy link

OskarDamkjaer commented Apr 4, 2022

I ran into this issue as well, my problem was not setting the environment key, that's why the publish step didn't have access to {{ secrets.NPM_TOKEN }}. More info in the github action docs here 😄

@mcous mcous added the question Further information is requested label Apr 7, 2023
@mcous
Copy link
Member

mcous commented Apr 7, 2023

Hi all, these all look like various misconfiguration issues. I'm going to close this issue since links to various action run logs posted have expired so reproduction would be overly difficult. If anyone is still experiencing issues, please feel free to open a new issue!

If you're interested in seeing a working configuration for this action, you can take a look at: https://github.com/viamrobotics/prime/blob/main/.github/workflows/publish.yml

@mcous mcous closed this as not planned Won't fix, can't repro, duplicate, stale Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

8 participants
@thegiantbeast @mcous @ayush-goyal @OskarDamkjaer @trivikr @Nurutomo @lastdoctor and others