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

ConvertFrom-Json : Invalid JSON primitive: . #16

Open
Krutoy242 opened this issue May 7, 2022 · 21 comments
Open

ConvertFrom-Json : Invalid JSON primitive: . #16

Krutoy242 opened this issue May 7, 2022 · 21 comments
Labels
bug Something isn't working

Comments

@Krutoy242
Copy link

Modpack Version

Describe your issue.

I setup settings.ps1 matching my pack options.
I skip all parts except actual uploading on CF.

When i lunch modpack-uploader.ps1 i see this:

Code_3qMrNWMwIv

Seems like something wrong with CF output.
Error:

ConvertFrom-Json : Недопустимый примитив JSON: .
D:\mc_client\Instances\Enigmatica2Expert - Extended\modpackUploader\modpack-uploader.ps1:245 знак:30       
+             --progress-bar | ConvertFrom-Json
+                              ~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [ConvertFrom-Json], ArgumentException
    + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.ConvertFromJsonCommand
 
Failed to upload client files: 
Failed to upload client files: 
D:\mc_client\Instances\Enigmatica2Expert - Extended\modpackUploader\modpack-uploader.ps1:252 знак:13
+             throw "Failed to upload client files: $response"
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Failed to upload client files: :String) [], RuntimeException
    + FullyQualifiedErrorId : Failed to upload client files: 

I tried to redirect output of curl.exe in file:

- --progress-bar | ConvertFrom-Json
+ > out.html

Opening out.html i see this:

image

Why this happen? How to fix that?

Crash Report

No response

Latest Log

No response

Have you modified the modpack?

No

User Modifications

No response

Did the issue happen in singleplayer or on a server?

Both

@Krutoy242 Krutoy242 added the bug Something isn't working label May 7, 2022
@NielsPilgaard
Copy link
Collaborator

NielsPilgaard commented May 7, 2022

Thanks for the report. Could you please provide your settings.ps1 file? Also, I take it you've added your api token to the secrets.ps1 file?

@MetaverseRPN
Copy link

MetaverseRPN commented May 7, 2022

I am also getting the same error, API token is added. my setttings.ps1 is here: https://gist.github.com/MetaverseRPN/de37892b5eefcc4981cda3f229c58cfc

Gist
GitHub Gist: instantly share code, notes, and snippets.

@NielsPilgaard
Copy link
Collaborator

Any chance you have a the returned error in english? 😅

@MetaverseRPN
Copy link

MetaverseRPN commented May 7, 2022

I do. Here it is:

Failed to upload client files: @{errorCode=1002; errorMessage=Error in field `metadata`:
Invalid JSON.}
Failed to upload client files: @{errorCode=1002; errorMessage=Error in field `metadata`:
Invalid JSON.}
At C:\Users\nicho\curseforge\minecraft\Instances\Protocol Beta test\modpack-uploader.ps1:250 char:13
+             throw "Failed to upload client files: $response"
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Failed to uploa...
Invalid JSON.}:String) [], RuntimeException
    + FullyQualifiedErrorId : Failed to upload client files: @{errorCode=1002; errorMessage=Error in field `metadata`:

Invalid JSON.}

Edit: only took 5 tries to get that codeblocked correctly

@NielsPilgaard
Copy link
Collaborator

Thank you kindly. Do you also have the output just prior to this? I'm looking for something like this:

Client Metadata:

{
            changelog: 'The Changelog is currently being written, it should be done soon.',
            changelogType: 'markdown',
            displayName: 'Enigmatica 6 1.2.1',
            gameVersions: [8203],
            releaseType: 'alpha'
        }

@MetaverseRPN
Copy link

Client Metadata:

{
            changelog: 'You aren't supposed to be here... There is nothing for you to see here...',
            changelogType: 'markdown',
            displayName: 'PhoenixRising 0.0.1',
            gameVersions: [6756],
            releaseType: 'beta'
        }

Is this what you are looking for?

@NielsPilgaard
Copy link
Collaborator

It is indeed. Odd, that looks perfectly valid.
I'm guessing they're finally patching the odd json format they used to expect. Could you perhaps re-try a couple of times, see if you reach one of their API servers that haven't updated yet? 😄 I was able to use this a few minutes ago.

@MetaverseRPN
Copy link

Im trying for the 3rd time but it seems I am getting this error every time I try

@Krutoy242
Copy link
Author

Yes, i tried different time a day and same error.

@NielsPilgaard
Copy link
Collaborator

NielsPilgaard commented May 7, 2022

Hmm alright. Could you please try replacing the setting of the $CLIENT_METADATA parameter like below?

Change this:

$CLIENT_METADATA = 
        "{
            changelog: `'$CLIENT_CHANGELOG`',
            changelogType: `'$CLIENT_CHANGELOG_TYPE`',
            displayName: `'$CLIENT_FILE_DISPLAY_NAME`',
            gameVersions: [$GAME_VERSIONS],
            releaseType: `'$CLIENT_RELEASE_TYPE`'
        }"

to this:

$CLIENT_METADATA = @{
    changelog     = $CLIENT_CHANGELOG
    changelogType = $CLIENT_CHANGELOG_TYPE
    displayName   = $CLIENT_FILE_DISPLAY_NAME
    gameVersions  = $GAME_VERSIONS
    releaseType   = $CLIENT_RELEASE_TYPE
} | ConvertTo-Json

@MetaverseRPN
Copy link

Trying it now

@MetaverseRPN
Copy link

um.... Ok this is a new one.....

curl: (6) Could not resolve host: aren\u0027t

curl: (6) Could not resolve host: supposed

curl: (6) Could not resolve host: to

curl: (6) Could not resolve host: be

curl: (6) Could not resolve host: here...

curl: (6) Could not resolve host: There

curl: (6) Could not resolve host: is

curl: (6) Could not resolve host: nothing

curl: (6) Could not resolve host: for

curl: (6) Could not resolve host: you

curl: (6) Could not resolve host: to

curl: (6) Could not resolve host: see

curl: (3) bad range specification in URL position 31:
here...,
    gameVersions:  [
                         6756
                     ],
    changelogType:  markdown,
    releaseType:  beta,
    displayName:  PhoenixRising

@NielsPilgaard
Copy link
Collaborator

Yikes. CurseForge still dislikes normal JSON I guess :P

Please revert that change, and make this change instead:

Change:

-F metadata=$CLIENT_METADATA

to

-F metadata=([System.Text.Encoding]::UTF8.GetBytes($CLIENT_METADATA ))

@Krutoy242
Copy link
Author

-F metadata=([System.Text.Encoding]::UTF8.GetBytes($CLIENT_METADATA ))

I tried this. After uploading progress bar, slowly got similar messages curl: (6) Could not resolve host: 32 again and again:

######################################################################## 100,0%

curl: (6) Could not resolve host: 123

curl: (6) Could not resolve host: 13

curl: (6) Could not resolve host: 10

curl: (6) Could not resolve host: 32

curl: (6) Could not resolve host: 32

curl: (6) Could not resolve host: 32

curl: (6) Could not resolve host: 32

curl: (6) Could not resolve host: 32

@NielsPilgaard
Copy link
Collaborator

NielsPilgaard commented May 10, 2022

Oh woops, I think it should've been:
-F metadata=([System.Text.Encoding]::UTF8.GetString($CLIENT_METADATA))

@Krutoy242
Copy link
Author

The argument "bytes" cannot be converted, with the value: "{
            changelog: 'The Changelog is currently being written, please ignore.',
            changelogType: 'markdown',
            displayName: 'E2E-Extended v0.56.0',
            gameVersions: [6756],
            releaseType: 'beta'
        }", for "GetString" into type "System.Byte[]": "Cannot convert value "{
            changelog: 'The Changelog is currently being written, please ignore.',
            changelogType: 'markdown',
            displayName: 'E2E-Extended v0.56.0',
            gameVersions: [6756],
            releaseType: 'beta'
        }" в тип "System.Byte[]". Error: "Cannot convert value "{
            changelog: 'The Changelog is currently being written, please ignore.',
            changelogType: 'markdown',
            displayName: 'E2E-Extended v0.56.0',
            gameVersions: [6756],
            releaseType: 'beta'
        }" в тип "System.Byte". Ошибка: "The input string was in the wrong format."""
D:\mc_client\Instances\Enigmatica2Expert - Extended\modpackUploader\modpack-uploader.ps1:238 знак:9
+         $response = curl.exe `
+         ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument
 
Failed to upload client files: 
Failed to upload client files: 
D:\mc_client\Instances\Enigmatica2Expert - Extended\modpackUploader\modpack-uploader.ps1:252 знак:13
+             throw "Failed to upload client files: $response"
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Failed to upload client files: :String) [], RuntimeException
    + FullyQualifiedErrorId : Failed to upload client files: 

@NielsPilgaard
Copy link
Collaborator

Client Metadata:

{
            changelog: 'You aren't supposed to be here... There is nothing for you to see here...',
            changelogType: 'markdown',
            displayName: 'PhoenixRising 0.0.1',
            gameVersions: [6756],
            releaseType: 'beta'
        }

Is this what you are looking for?

Actually, try removing the ' from aren't

@NielsPilgaard
Copy link
Collaborator

-F metadata=([System.Text.Encoding]::UTF8.GetBytes($CLIENT_METADATA ))

I tried this. After uploading progress bar, slowly got similar messages curl: (6) Could not resolve host: 32 again and again:

######################################################################## 100,0%

curl: (6) Could not resolve host: 123

curl: (6) Could not resolve host: 13

curl: (6) Could not resolve host: 10

curl: (6) Could not resolve host: 32

curl: (6) Could not resolve host: 32

curl: (6) Could not resolve host: 32

curl: (6) Could not resolve host: 32

curl: (6) Could not resolve host: 32

Did you try this fix as well? #16 (comment)

@Krutoy242
Copy link
Author

Krutoy242 commented May 11, 2022

Did you try this fix as well? #16 (comment)

Yes, same error as in #16 (comment)

Client Metadata:

{
    "changelog":  "The Changelog is currently being written, please ignore.",
    "gameVersions":  [
                         6756
                     ],
    "changelogType":  "markdown",
    "releaseType":  "beta",
    "displayName":  "E2E-Extended v0.56.0"
}

Uploading client files to https://minecraft.curseforge.com/api/projects/561105/upload-file

Не удается преобразовать аргумент "bytes", со значением: "{
    "changelog":  "The Changelog is currently being written, please ignore.",
    "gameVersions":  [
                         6756
                     ],
    "changelogType":  "markdown",
    "releaseType":  "beta",
    "displayName":  "E2E-Extended v0.56.0"
}", для "GetString" в тип "System.Byte[]": "Не удается преобразовать значение "{
    "changelog":  "The Changelog is currently being written, please ignore.",
    "gameVersions":  [
                         6756
                     ],
    "changelogType":  "markdown",
    "releaseType":  "beta",
    "displayName":  "E2E-Extended v0.56.0"
}" в тип "System.Byte[]". Ошибка: "Не удается преобразовать значение "{
    "changelog":  "The Changelog is currently being written, please ignore.",
    "gameVersions":  [
                         6756
                     ],
    "changelogType":  "markdown",
    "releaseType":  "beta",
    "displayName":  "E2E-Extended v0.56.0"
}" в тип "System.Byte". Ошибка: "Входная строка имела неверный формат."""
D:\mc_client\Instances\Enigmatica2Expert - Extended\modpackUploader\modpack-uploader.ps1:237 знак:9
+         $response = curl.exe `
+         ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Failed to upload client files:
Failed to upload client files:
D:\mc_client\Instances\Enigmatica2Expert - Extended\modpackUploader\modpack-uploader.ps1:251 знак:13
+             throw "Failed to upload client files: $response"
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Failed to upload client files: :String) [], RuntimeException
    + FullyQualifiedErrorId : Failed to upload client files:

@NielsPilgaard
Copy link
Collaborator

Damn, I'll think on it some more then, and try to reproduce it some more.

@MetaverseRPN
Copy link

MetaverseRPN commented May 16, 2022

Client Metadata:

{
            changelog: 'You aren't supposed to be here... There is nothing for you to see here...',
            changelogType: 'markdown',
            displayName: 'PhoenixRising 0.0.1',
            gameVersions: [6756],
            releaseType: 'beta'
        }

Is this what you are looking for?

Actually, try removing the ' from aren't

removing the ' fixed it for me, but now I have a completely different issue I'm running into. The manifest that the modpackuploader.ps1 is generating is referencing two mods that are most certainly not in my pack, causing a invalid manifest error: https://cflookup.com/462460?fileId=3253803 https://cflookup.com/446346?fileId=3202390
I will open a new issue for that one as this is a completely different issue now

What CurseForge Project Is This? is a tool to help you find the CurseForge project or file based on a ID.
ComputerCraft Addons

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants