Import Content fails in Ghost 5.26 - Docker

Hello there. I’m creating a new instance of Ghost with docker-compose in my machine, the idea is to import contents from a older blog to this one.

However, when I try it, the notification on my email says the import was unsuccessful.
When I look into the https___ghost_fission_codes_production.error.log
This is what I see:

{"0":{"statusCode":422,"errorType":"ValidationError","level":"normal","message":"ValidationError: Validation (isEmpty) failed for unsplash\nValidationError: Validation (isIn) failed for unsplash","id":"62131cd1-9d8e-11ed-b1a0-b5ee3bff3a00",
"context":"{\"key\":\"unsplash\",\"group\":\"unsplash\",\"type\":\"boolean\",\"flags\":null,\"created_by\":1,\"created_at\":\"2019-05-07T16:42:25.000Z\",\"updated_by\":1,\"updated_at\":\"2021-08-12T17:56:59.000Z\"}",
"name":"ValidationError","code":null,"property":null,"redirect":null,"hideStack":false},
"name":"Log","hostname":"b6c0405b7c86","pid":1,"level":50,"msg":"Content import was unsuccessful","time":"2023-01-26T15:30:43.318Z","v":0}

The NGINX client_max_body_size is set to 100MB and my JSON file has 7.7 MB. I was searching in other topics and looks like the problem is with this unplash, is this the same case?

Thanks a lot

Are you able to share your JSON file? It seems like there’s something off about its formatting that’s causing this error.

1 Like

I think I could send part of it, without the text part that would include some content, names, emails, do you think the posts part could be the problem?

Yeah, even if you could just share it’s properties (not the data), that would be helpful.

You can see what the general format of the data should be here, too:

So, would be something like this (it’s not parsed, unfortunately cause there are millions of lines):

{"db":
[{"meta":
{"exported_on":1674609179862,"version":"3.42.5"},
"data":{"actions":[{"id","resource_id","resource_type","actor_id","actor_type","event","context","created_at"}],
"api_keys":[{"id","type","secret","role_id","integration_id","last_seen_at","last_seen_version","created_at","updated_at","user_id"}], 
"brute":[{"key","firstRequest","lastRequest","lifetime","count"}], 
"emails":[],
"integrations":[{...}],
"invites":[],
"labels":[],
"members":[{...}],
"members_email_change_events":[],
"members_labels":[],
"members_login_events":[],
"members_paid_subscription_events":[],
"members_payment_events":[],
"members_status_events":[{...}]
"members_stripe_customers":[],
"members_stripe_customers_subscriptions":[],
"members_subscribe_events":[{...}],
"migrations":[{...}],
"permissions_roles":[{...}],
"permissions_users":[],
"posts":[{...}]
.
.
.
}}

The ones with [{...}] contain multiple fields and I didn’t want to write all of them. After posts we also have “post_meta”, “post_authors”, “post_tags”,“roles”,“settings”.
Maybe I’ll try a new export and see what happens.

Your file format doesn’t seem like it’s matching the one specified in the migration doc.

Please try pruning it so that it matches this format:

{
    "meta":{
        // epoch time in milliseconds
        "exported_on":  1388805572000,
        "version":      "2.14.0"
    },
    "data":{
        "posts": [
            {
                ...
            }
        ],
        "tags": [
            {
              
            }
        ],
        "posts_tags": [
            {},
        ],
        "users": [
            {
                
            }
        ],
        // Provide this if you want different roles to the default "Author" role
        "roles_users": [
            {
             
            }
        ]
    }
}
1 Like

I’ve managed to split the file in two, and fixed the encoding/spacing problems, after that the import worked fine.
Thanks!

2 Likes