CMS Development

pacobosque
Participante

Can't upload fields.json via CLI

resolver

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 Avaliação positiva
1 Solução aceita
pacobosque
Solução
Participante

Can't upload fields.json via CLI

resolver

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!

 

Exibir solução no post original

6 Respostas 6
pacobosque
Solução
Participante

Can't upload fields.json via CLI

resolver

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
Gerente da Comunidade
Gerente da Comunidade

Can't upload fields.json via CLI

resolver

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 Avaliação positiva
pacobosque
Participante

Can't upload fields.json via CLI

resolver

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 Avaliação positiva
Mike_Eastwood
Especialista reconhecido(a) | Parceiro Ouro
Especialista reconhecido(a) | Parceiro Ouro

Can't upload fields.json via CLI

resolver

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
Gerente da Comunidade
Gerente da Comunidade

Can't upload fields.json via CLI

resolver

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 Avaliação positiva
pacobosque
Participante

Can't upload fields.json via CLI

resolver

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 Avaliação positiva