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

Deploy fails in 1 instance of a site #417

Open
DonKoko opened this issue Mar 20, 2023 · 17 comments
Open

Deploy fails in 1 instance of a site #417

DonKoko opened this issue Mar 20, 2023 · 17 comments

Comments

@DonKoko
Copy link
Contributor

DonKoko commented Mar 20, 2023

On my engine I have 2 versions of a site:

  • production
  • Test

Deploying my code to the test site works without issue, however when I try to deploy to the live site I get this error in wagon:

bundle exec wagon deploy prod -v

Pushing Sections
  persisting Logos [done]
  persisting Software [failed]
    Locomotive Back-office error. Contact your administrator or check your application logs.

# Error description:
undefined method `<' for nil:NilClass

# Backtrace:

	/Users/donkoko/.rvm/gems/ruby-2.7.7/gems/locomotivecms_coal-1.6.0/lib/locomotive/coal/resources/concerns/request.rb:54:in `do_request'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/gems/locomotivecms_coal-1.6.0/lib/locomotive/coal/resources/concerns/request.rb:7:in `get'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/gems/locomotivecms_coal-1.6.0/lib/locomotive/coal/resources/base.rb:17:in `index'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/commands/push_sub_commands/push_content_assets_command.rb:46:in `block in remote_entities'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/commands/push_sub_commands/push_content_assets_command.rb:45:in `tap'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/commands/push_sub_commands/push_content_assets_command.rb:45:in `remote_entities'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/commands/push_sub_commands/push_content_assets_command.rb:39:in `remote_entity'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/commands/push_sub_commands/push_content_assets_command.rb:18:in `persist'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/decorators/concerns/persist_assets_concern.rb:11:in `block in replace_with_content_assets!'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/decorators/concerns/persist_assets_concern.rb:10:in `gsub'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/decorators/concerns/persist_assets_concern.rb:10:in `replace_with_content_assets!'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/decorators/section_decorator.rb:29:in `definition'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/decorators/concerns/to_hash_concern.rb:10:in `public_send'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/decorators/concerns/to_hash_concern.rb:10:in `block (2 levels) in to_hash'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/decorators/concerns/to_hash_concern.rb:9:in `each'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/decorators/concerns/to_hash_concern.rb:9:in `block in to_hash'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/decorators/concerns/to_hash_concern.rb:8:in `tap'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/decorators/concerns/to_hash_concern.rb:8:in `to_hash'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/commands/push_sub_commands/push_sections_command.rb:14:in `persist'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/commands/push_sub_commands/push_base_command.rb:34:in `block in _push'
	/Users/donkoko/.rvm/rubies/ruby-2.7.7/lib/ruby/2.7.0/forwardable.rb:235:in `each'
	/Users/donkoko/.rvm/rubies/ruby-2.7.7/lib/ruby/2.7.0/forwardable.rb:235:in `each'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/commands/push_sub_commands/push_base_command.rb:30:in `_push'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/commands/push_sub_commands/push_base_command.rb:25:in `block in _push_with_timezone'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/gems/activesupport-5.2.6/lib/active_support/core_ext/time/zones.rb:66:in `use_zone'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/commands/push_sub_commands/push_base_command.rb:24:in `_push_with_timezone'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/commands/push_sub_commands/push_base_command.rb:18:in `block in push'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/gems/activesupport-5.2.6/lib/active_support/notifications.rb:170:in `instrument'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/commands/push_sub_commands/push_base_command.rb:50:in `instrument'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/commands/push_sub_commands/push_base_command.rb:16:in `push'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/commands/push_sub_commands/push_base_command.rb:12:in `push'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/commands/push_command.rb:65:in `block in _push'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/commands/push_command.rb:94:in `block in each_resource'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/commands/push_command.rb:87:in `each'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/commands/push_command.rb:87:in `each_resource'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/commands/push_command.rb:64:in `_push'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/commands/push_command.rb:51:in `push'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/commands/push_command.rb:31:in `push'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon.rb:74:in `push'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/cli.rb:352:in `deploy'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/bin/wagon:73:in `<top (required)>'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bin/wagon:23:in `load'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bin/wagon:23:in `<main>'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bin/ruby_executable_hooks:22:in `eval'
	/Users/donkoko/.rvm/gems/ruby-2.7.7/bin/ruby_executable_hooks:22:in `<main>'

And in the engine logs I can see:

2023-03-20T11:13:42.545157+00:00 app[web.1]: caught error of type NoMethodError in after callback inside Grape::Middleware::Formatter : undefined method `<' for nil:NilClass

I think its important to note that the error happens when deploying a section that doesn't really have changes in it.

@greyskin
Copy link

I've had this error before. From memory I had to sync the site with -d, delete the sections, re-deploy the sections, then re-deploy the section data.

@DonKoko
Copy link
Contributor Author

DonKoko commented Mar 21, 2023

Thanks @greyskin. Thats a tough one. I am wondering whats causing this error. I am really having trouble understanding how it works.

@greyskin
Copy link

greyskin commented Mar 21, 2023

You haven't changed a field type or anything? Or removed a field but the data is still there? I'm pretty sure I did that one time...

@DonKoko
Copy link
Contributor Author

DonKoko commented Mar 21, 2023

Yeah I have made changes, but not to the section that is breaking. I also tried to basically remove this section to see if it deploys, and then another section crashes the deploy with the same error.
I guess I will have to do this what you suggested. Quite scary as its a bit site.

@greyskin
Copy link

Yeah man I hear you - I felt the same way when I had this issue. I've also had similar issues with content_type deployment - where in order to deploy a change in one content_type I've had to sync content_entries, delete all content_types, and then re-deploy content_types and content_entries. Very scary on live sites. It has always worked and resolved the issue though - each time I have to do it it's less scary. 🙂

@DonKoko
Copy link
Contributor Author

DonKoko commented Mar 22, 2023

Unfortunately I didn't have the same experience. Basically nothing worked as expected on the way so my whole site got corrupted on live and now deploying with data also doesn't work for some reason. I am getting errors such as:

persisting Blogs /  [failed]
    Resource invalid: title can't be blank

# Error description:
Resource invalid: title can't be blank

When the title in the blog is for sure not blank.
Anyways thanks for the suggestion and help. I am now trying to figure out how to solve this.

@greyskin
Copy link

Is blogs a content_type or a section? I thought it was sections that were the issue...

@DonKoko
Copy link
Contributor Author

DonKoko commented Mar 22, 2023

Yes blog is a content type and yes sections were the issue.
I basically deleted the whole site and now even tho I have created a completely new site, pushing with -d just doesnt work.

SO yeah now I am just trying to 1 by one solve everything but I am getting errors on every second file.
Things like this for example:

persisting visitor-management (nl, en) [done]
 [failed]
    undefined method `+' for nil:NilClass

# Error description:
undefined method `+' for nil:NilClass

# Backtrace:

	/Users/donkoko/.rvm/gems/ruby-2.7.7/bundler/gems/wagon-2c4391ae63e6/lib/locomotive/wagon/commands/push_sub_commands/push_pages_command.rb:40:in `label_for'

which is this line: https://github.com/locomotivecms/wagon/blob/master/lib/locomotive/wagon/commands/push_sub_commands/push_pages_command.rb#L40

So I guess its something to do with locales,

Also wagon seems to try to deploy child pages without first deploying the parent. Its just many different errors and parts breaking.

Ooh and btw, the site works on my local. I just cannot deploy it with data.

@greyskin
Copy link

Ok there is a lot here that is familiar to me.

Do you have timezone set in your site.yml?

Do you have pages and folders set up for your parent pages? (If you don't have a page and a folder, it will work in wagon but won't deploy the child page nested).

@DonKoko
Copy link
Contributor Author

DonKoko commented Mar 22, 2023

Do you have timezone set in your site.yml?

Yes, the timezone in my site.yml is the same like in the site on the server, however different than the timezone I am in now. Could that be a reason?

Do you have pages and folders set up for your parent pages? (If you don't have a page and a folder, it will work in wagon but won't deploy the child page nested).

OKey so from what I understand i need to create a page corresponding to each folder? WHat should be the content of the json file of those pages?

EDIT: The issue seems to be evolving. How i cant even deploy site.yml to my original site. Error i see is this again:
2023-03-22T11:57:14.199062+00:00 app[web.1]: caught error of type NoMethodError in after callback inside Grape::Middleware::Formatter : undefined method <' for nil:NilClass`

@DonKoko
Copy link
Contributor Author

DonKoko commented Mar 22, 2023

@greyskin do you know if there is a way to deploy only 1 page including its data.
I tried something like this but it didnt work:
bundle exec wagon deploy prod -r pages -f industries.liquid -d -e live-v

or

bundle exec wagon deploy prod -r pages -f industries.json -d -e live-v

@greyskin
Copy link

Yes, the timezone in my site.yml is the same like in the site on the server, however different than the timezone I am in now. Could that be a reason?

No, your timezone can be any valid timezone - as long as it is set. Deploying without a timezone set will (from memory) result in a nilClass error.

OK so from what I understand i need to create a page corresponding to each folder? What should be the content of the json file of those pages?

It will need to have (from memory) an extends parent or similar. Other than that I think it can be pretty much blank. Happy to send you an example if need be.

@greyskin
Copy link

greyskin commented Mar 22, 2023

do you know if there is a way to deploy only 1 page including its data. I tried something like this but it didnt work:
bundle exec wagon deploy prod -r pages -f industries.liquid -d -e live-v

You can 100% deploy single pages:
wagon deploy prod -r pages -f industries.liquid -d -e live -v

Do you get an error message?

@DonKoko
Copy link
Contributor Author

DonKoko commented Mar 22, 2023

No, I get a success message but it doesnt deploy anything. Like no changes in the site.
In the end thankfully i had backup locally so I am basically manually fixing a lot of pages. Thanks for all your help anyways.

@greyskin
Copy link

greyskin commented Mar 22, 2023

Are you using bundle exec wagon deploy or just straight wagon deploy? I swear there are some differences between the two. Also (sorry to ask) but you definitely have an industries.json page under your data/live folder?

@DonKoko
Copy link
Contributor Author

DonKoko commented Mar 22, 2023

Yeah i tried both with and without bundle exec. I am also sure I have the page and i tried with multiple pages, on root level and with some that have parent.
I mean I have also done this many times before, thats why i dont get it why its not working at all this time.
I will continue testing and will let you know if I find something.

@greyskin
Copy link

greyskin commented Mar 22, 2023

For sure - I totally know what you mean - when I've had these issues it's the same - only trying to do something I do every day. Maybe try moving the page in question into another site and deploying to check it isn't the page itself...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants