Kir-Antipov / mc-publish

🚀 Your one-stop GitHub Action for seamless Minecraft project publication across various platforms.
MIT License
228 stars 20 forks source link

[Question] Modrinth throws `Invalid character '-' in base62 encoding` #117

Closed SmajloSlovakian closed 5 months ago

SmajloSlovakian commented 5 months ago

Description

this is the error: HttpError: 400 (Bad Request, {"error":"invalid_input","description":"Error while parsing JSON: Invalid character '-' in base62 encoding at line 1 column 87"})

this is how the action step looks like:

      - name: Publishing to Modrinth
        uses: Kir-Antipov/mc-publish@v3.3
        with:
          # Only include this section if you wish to publish
          # your assets on Modrinth.
          modrinth-id: 'illegal-mct'
          modrinth-token: "${{secrets.MODRINTH_TOKEN}}"
          name: "releasenameoption" #${{env.RELEASE_NAME}}
          version: "versionoption" #${{env.VERSION}}
          files: "Illegalmc/IllegalMCT.zip"
          loaders: "vanilla"

Expected Behavior

publishes the version without issues

Actual Behavior

errors out

Version

3.3

Environment

GitHub Actions

Configuration

- name: Publishing to Modrinth
        uses: Kir-Antipov/mc-publish@v3.3
        with:
          # Only include this section if you wish to publish
          # your assets on Modrinth.
          modrinth-id: 'illegal-mct'
          modrinth-token: "${{secrets.MODRINTH_TOKEN}}"
          name: "releasenameoption" #${{env.RELEASE_NAME}}
          version: "versionoption" #${{env.VERSION}}
          files: "Illegalmc/IllegalMCT.zip"
          loaders: "vanilla"

Logs

##[debug]Evaluating condition for step: 'Publishing to Modrinth'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Publishing to Modrinth
##[debug]Loading inputs
##[debug]Evaluating: secrets.MODRINTH_TOKEN
##[debug]Evaluating Index:
##[debug]..Evaluating secrets:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'MODRINTH_TOKEN'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Loading env
Run Kir-Antipov/mc-publish@v3.3
📤 Uploading assets to Modrinth
Error: HttpError: 400 (Bad Request, {"error":"invalid_input","description":"Error while parsing JSON: Invalid character '-' in base62 encoding at line 1 column 80"})
##[debug]Node Action run completed with exit code 1
##[debug]Finishing: Publishing to Modrinth

Other Information

No response

Kir-Antipov commented 5 months ago

Hi! There's either no Modrinth project named illegal-mct, or if it does exist but hasn't gone public yet, you probably haven't configured your access token properly. As a result, mc-publish cannot convert the slug you provided into an ID (hence the error, since the slug contains '-').

To resolve this, either adjust the permissions on your token or provide mc-publish with the actual project ID directly, so it doesn't need to convert it for you :)

https://github.com/Kir-Antipov/mc-publish/blob/c0f30ad683340ba9a5374ba42157179f30171107/src/platforms/modrinth/modrinth-uploader.ts#L82-L100

SmajloSlovakian commented 5 months ago

yeah the project is not public yet... i thought it sees the project as it has the token... i wanted to figure this all out before making it public...

SmajloSlovakian commented 5 months ago

i have added the read projects permission to the token and it works... thx for the help

Kir-Antipov commented 5 months ago

i thought it sees the project as it has the token

Well, as you've already figured out, it does when the token has all the right privileges set up for it :)

i have added the read projects permission to the token and it works

You are welcome!