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

"error":"json: cannot unmarshal object into Go value of type []*server.importStorageObject" #347

Closed
AlexeyIS opened this issue May 21, 2019 · 9 comments

Comments

@AlexeyIS
Copy link

commented May 21, 2019

Before you submit an issue we recommend you drop into the Gitter community and ask any questions you have or mention any problems you've had getting started with the server.

Please provide as much information as you can with this issue report. If you believe it may be an issue with one of the client libraries please report it on their own trackers.

Description

Getting 'Failed to upload the file' error when uploading json file to Storage in admin panel.
Logs: {"level":"warn","ts":"2019-05-21T11:03:22.819-0700","msg":"Could not parse JSON file.","error":"json: cannot unmarshal object into Go value of type []*server.importStorageObject"}

$ ./nakama --version
2.5.1+8216d5cc

Json I am trying to upload:
{ "items": [ { "desc": null, "id": "3423", "name": null, "parameters": null, "quantity": 0, "tags": null, "type": 0 } ], "version": "1" }

Steps to Reproduce

  1. Login as admin to
  2. Go to Storage
  3. Select Import Json file
  4. drag and drop json file.
  5. Error appears: Failed to upload the file.

Expected Result

No error is thrown and json file uploaded

Actual Result

The error appears: Failed to upload the file.
Terminal logs: {"level":"warn","ts":"2019-05-21T11:03:22.819-0700","msg":"Could not parse JSON file.","error":"json: cannot unmarshal object into Go value of type []*server.importStorageObject"}

Context

  • Unity
  • Unreal
  • Other(web)

Your Environment

  • Nakama: 2.5.1+8216d5cc
  • Cockroach: v2.1.6
  • Environment name and version:
  • Operating System and version: OSX 10.14.4
@mofirouz

This comment has been minimized.

Copy link
Member

commented May 21, 2019

The file you are trying to upload doesn’t match the required format by the system.

Where is the origin of the file?

@AlexeyIS

This comment has been minimized.

Copy link
Author

commented May 21, 2019

@mofirouz Here is the file I try to upload config.txt
Could you please advice on the format for json file?

@mofirouz

This comment has been minimized.

Copy link
Member

commented May 21, 2019

I meant what has generated the config.txt file

@AlexeyIS

This comment has been minimized.

Copy link
Author

commented May 21, 2019

@mofirouz oh sorry, It was just manually created.

@mofirouz

This comment has been minimized.

Copy link
Member

commented May 21, 2019

Ah ok, was there a particular specification you followed to create the JSON records? Ie how did you come up with that structure?

@AlexeyIS

This comment has been minimized.

Copy link
Author

commented May 21, 2019

@mofirouz The end goal is to pull this data from Unity later. The specification for that particular json is coming from internal needs.

@mofirouz

This comment has been minimized.

Copy link
Member

commented May 22, 2019

This is the format that the JSON importer expects:

[
  {
    "collection": "testcollection",
    "key": "testkey",
    "user_id": "fb912423-82cb-4e3a-8f67-42c37be19a3c",
    "value": "{\"hello\": \"world\"}",
    "permission_read": 2,
    "permission_write": 1
  },
  {
    "collection": "testcollection",
    "key": "testkey2",
    "user_id": "9e997e08-7e81-4d3b-a3d3-3458f7c5e5e1",
    "value": "{\"hello\": \"world\"}",
    "permission_read": 1,
    "permission_write": 1
  }
]
@mofirouz mofirouz closed this May 22, 2019
@novabyte

This comment has been minimized.

Copy link
Member

commented May 22, 2019

@mofirouz We should make a note to add this advice to the docs for the expected import format with the Developer Console. 📓

@AlexeyIS

This comment has been minimized.

Copy link
Author

commented May 22, 2019

Thanks for the help guys! I wanted to mention, great that you have such a quick feedback time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.