CMS Development

pacobosque
Participant

Can't upload fields.json via CLI

SOLVE

I'm trying to copy the fields from a module in one account to another account where I want to make the same module. First I use the "Copy JSON" to copy the entire fields.json from the account with the existing module. Then using the CLI in VS Code I use the "hs upload" command to upload the fields.json to the new module in the other account. Each time I look at the module in the Design Manager though the fields continue to be empty. I do see the success message in the CLI: "[SUCCESS] Uploaded file from x to y in the Design Manager of account z". Every other CLI command I am running works just fine, eg. hs list, hs fetch, etc. What do I need to do to get that fields.json imported and active in the module in the other account?

0 Upvotes
1 Accepted solution
pacobosque
Solution
Participant

Can't upload fields.json via CLI

SOLVE

I figured out the problem. Even though the CLI gave me a success message when I ran hs upload, there was an issue with my path.

 

At first I was trying the command like this:

hs upload "C:\Users\example\module-name.module\fields.json" "theme child/modules/module-name.module"

I'd get a success message but the original fields.json was still reflected in the Fields UI in the right column. So I'm not sure what I was succeeding at but it was not uploading and replacing the fields.json.

 

The problem was that in order for it to overwrite the existing fields.json, I needed to include fields.json at the end of destination path like this:

hs upload "C:\Users\example\module-name.module\fields.json" "theme child/modules/module-name.module/fields.json"

That worked finally!

 

View solution in original post

6 Replies 6
pacobosque
Solution
Participant

Can't upload fields.json via CLI

SOLVE

I figured out the problem. Even though the CLI gave me a success message when I ran hs upload, there was an issue with my path.

 

At first I was trying the command like this:

hs upload "C:\Users\example\module-name.module\fields.json" "theme child/modules/module-name.module"

I'd get a success message but the original fields.json was still reflected in the Fields UI in the right column. So I'm not sure what I was succeeding at but it was not uploading and replacing the fields.json.

 

The problem was that in order for it to overwrite the existing fields.json, I needed to include fields.json at the end of destination path like this:

hs upload "C:\Users\example\module-name.module\fields.json" "theme child/modules/module-name.module/fields.json"

That worked finally!

 

BérangèreL
Community Manager
Community Manager

Can't upload fields.json via CLI

SOLVE

Hi @pacobosque, I hope that you are well!

Thanks a lot for sharing the solution with the Community! And thanks so much @Mike_Eastwood for your help!
 

This will be really helpful to other Community Members who experience the same!

Have a lovely day!

Best,
Bérangère


Saviez-vous que la Communauté est disponible en Français ?
Rejoignez les discussions francophones en changeant votre langue dans les paramètres !

Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings!


0 Upvotes
pacobosque
Participant

Can't upload fields.json via CLI

SOLVE

Here's a little more info. The account where the fields.json is copied from has CMS Hub Professional while the account I am trying to upload it to is CMS Hub Starter. I don't know if that matters. Also the fields.json is created by Hubspot and I am not changing it at all. It's a very large file. Lastly despite the fields.json upload success message, the whole fields panel remains empty as you can see in this screenshot:
fields-module.jpg

0 Upvotes
Mike_Eastwood
Recognized Expert | Gold Partner
Recognized Expert | Gold Partner

Can't upload fields.json via CLI

SOLVE

Hi @pacobosque 

 

My guess (and I mean guess) would be invalid json that's not being published.

 

I would try validating you json and trying again.

 

And/or manually pasting the json into the editor in the browser (which will also highlight any potential issues).

 

Have fun

Mike

 

p.s. thank you for the mention @BérangèreL 

 

Here to learn more about HubSpot and share my HubSpot Knowledge. I'm the founder of Webalite a Gold HubSpot Partner Agency based in Wellington, New Zealand and the founder of Portal-iQ the world's first automated HubSpot Portal Audit that helps you work smarter with HubSpot.

BérangèreL
Community Manager
Community Manager

Can't upload fields.json via CLI

SOLVE

Hi @pacobosque,

Thank you for asking the Community!

Can you share the section of your JSON body that is giving the error, please?

The more info, screenshots (without sensitive/confidential information), and details you can provide, the better the Community can assist.


I'd like to invite a couple of subject matter experts and some Community Members to this conversation: Hi @sst, @DStaniszewski, @Kevin-C, @FMontenegro, @Mike_Eastwood, @andireuter @LFilip and @gabriel-nextiny do you have suggestions to help @pacobosque, please?

Also, if anybody else has anything to add and/or share, please feel free to join in the conversation 🙂

Thank you so much and have a great day!

Best,
Bérangère


Saviez-vous que la Communauté est disponible en Français ?
Rejoignez les discussions francophones en changeant votre langue dans les paramètres !

Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings!


0 Upvotes
pacobosque
Participant

Can't upload fields.json via CLI

SOLVE

The fields.json file is generated by Hubspot so I was thinking it's going to be valid and it is when I run it through https://jsonlint.com/. Then I also pasted into the Hubspot browser editor and it says "no errors found". Open to other ideas.

0 Upvotes