Issue: Migrating OTRS 5.x to Zammad 2.9 #2019

Infos:

  • Used Zammad version: 2.9
  • Used Zammad installation source: DEB
  • Operating system: Ubuntu 16.04
  • Browser: Mozilla Firefox

Expected behavior:

  • Migration from OTRS 5.0.10 works as expected

Actual behavior:

  • When starting import I shortly got the message “undefined method `id’ for nil:NilClass”.
    so the production log generate this:

I, [2019-05-20T22:13:15.448300 #943-47023391831600] INFO – : Started POST “/api/v1/import/otrs/url_check” for 127.0.0.1 at 2019-05-20 22:13:15 -0400
I, [2019-05-20T22:13:15.453975 #943-47023391831600] INFO – : Processing by ImportOtrsController#url_check as JSON
I, [2019-05-20T22:13:15.454083 #943-47023391831600] INFO – : Parameters: {“url”=>“https://help.uii.ac.id/otrs/public.pl?Action=ZammadMigrator;Key=UvGREanTczAdBsX2E3ZSlrTAnukyTMeCpN8YdM7I”}
I, [2019-05-20T22:13:15.802727 #943-47023391831600] INFO – : Setting.set(‘import_backend’, “otrs”)
I, [2019-05-20T22:13:15.811046 #943-47023391831600] INFO – : Setting.set(‘import_otrs_endpoint’, “https://help.uii.ac.id/otrs/public.pl?Action=ZammadMigrator”)
I, [2019-05-20T22:13:15.817337 #943-47023391831600] INFO – : Setting.set(‘import_otrs_endpoint_key’, “UvGREanTczAdBsX2E3ZSlrTAnukyTMeCpN8YdM7I”)
I, [2019-05-20T22:13:15.820585 #943-47023391831600] INFO – : Completed 200 OK in 366ms (Views: 0.2ms | ActiveRecord: 8.2ms)
I, [2019-05-20T22:13:19.619606 #943-47023391830680] INFO – : Started POST “/api/v1/import/otrs/import_check” for 127.0.0.1 at 2019-05-20 22:13:19 -0400
I, [2019-05-20T22:13:19.623431 #943-47023391830680] INFO – : Processing by ImportOtrsController#import_check as JSON
I, [2019-05-20T22:13:19.623822 #943-47023391830680] INFO – : thread#-: POST: https://help.uii.ac.id/otrs/public.pl?Action=ZammadMigrator
I, [2019-05-20T22:13:19.623903 #943-47023391830680] INFO – : thread#-: PARAMS: {:Subaction=>“List”, :Action=>“ZammadMigrator”, :Key=>“UvGREanTczAdBsX2E3ZSlrTAnukyTMeCpN8YdM7I”}
I, [2019-05-20T22:13:20.146733 #943-47023391830680] INFO – : thread#-: POST: https://help.uii.ac.id/otrs/public.pl?Action=ZammadMigrator
I, [2019-05-20T22:13:20.146904 #943-47023391830680] INFO – : thread#-: PARAMS: {:Subaction=>“Export”, :Object=>“DynamicField”, :Limit=>"", :Offset=>"", :Diff=>0, :Action=>“ZammadMigrator”, :Key=>“UvGREanTczAdBsX2E3ZSlrTAnukyTMeCpN8YdM7I”}
I, [2019-05-20T22:13:20.491335 #943-47023391830680] INFO – : thread#-: POST: https://help.uii.ac.id/otrs/public.pl?Action=ZammadMigrator
I, [2019-05-20T22:13:20.491507 #943-47023391830680] INFO – : thread#-: PARAMS: {:Subaction=>“Export”, :Object=>“SysConfig”, :Limit=>"", :Offset=>"", :Diff=>0, :Action=>“ZammadMigrator”, :Key=>“UvGREanTczAdBsX2E3ZSlrTAnukyTMeCpN8YdM7I”}
I, [2019-05-20T22:13:21.252241 #943-47023391830680] INFO – : Completed 200 OK in 1629ms (Views: 0.2ms | ActiveRecord: 0.4ms)
I, [2019-05-20T22:13:21.303686 #943-47023391829420] INFO – : Started POST “/api/v1/import/otrs/import_start” for 127.0.0.1 at 2019-05-20 22:13:21 -0400
I, [2019-05-20T22:13:21.306894 #943-47023391829420] INFO – : Processing by ImportOtrsController#import_start as JSON
I, [2019-05-20T22:13:21.313446 #943-47023391829420] INFO – : Setting.set(‘import_mode’, true)
I, [2019-05-20T22:13:21.315201 #943-47023391829420] INFO – : thread#-: POST: https://help.uii.ac.id/otrs/public.pl?Action=ZammadMigrator
I, [2019-05-20T22:13:21.315288 #943-47023391829420] INFO – : thread#-: PARAMS: {:Action=>“ZammadMigrator”, :Key=>“UvGREanTczAdBsX2E3ZSlrTAnukyTMeCpN8YdM7I”}
I, [2019-05-20T22:13:21.720784 #943-47023391829420] INFO – : Completed 200 OK in 414ms (Views: 0.2ms | ActiveRecord: 8.0ms)
I, [2019-05-20T22:13:22.655649 #1073-47434002225460] INFO – : 2019-05-20T22:13:22-0400: [Worker(host:zammad-server pid:1073)] Job Module#start_bg (id=21) RUNNING
I, [2019-05-20T22:13:22.775326 #1073-47434002225460] INFO – : thread#-: POST: https://help.uii.ac.id/otrs/public.pl?Action=ZammadMigrator
I, [2019-05-20T22:13:22.775420 #1073-47434002225460] INFO – : thread#-: PARAMS: {:Action=>“ZammadMigrator”, :Key=>“UvGREanTczAdBsX2E3ZSlrTAnukyTMeCpN8YdM7I”}
I, [2019-05-20T22:13:23.123534 #1073-47433990388180] INFO – : thread#-: POST: https://help.uii.ac.id/otrs/public.pl?Action=ZammadMigrator
I, [2019-05-20T22:13:23.123682 #1073-47433990388180] INFO – : thread#-: PARAMS: {:Subaction=>“List”, :Action=>“ZammadMigrator”, :Key=>“UvGREanTczAdBsX2E3ZSlrTAnukyTMeCpN8YdM7I”}
I, [2019-05-20T22:13:23.775941 #943-47023391832460] INFO – : Started GET “/api/v1/import/otrs/import_status?=1558404483425" for 127.0.0.1 at 2019-05-20 22:13:23 -0400
I, [2019-05-20T22:13:23.779568 #943-47023391832460] INFO – : Processing by ImportOtrsController#import_status as JSON
I, [2019-05-20T22:13:23.779654 #943-47023391832460] INFO – : Parameters: {"
”=>“1558404483425”}
I, [2019-05-20T22:13:23.780403 #943-47023391832460] INFO – : Completed 200 OK in 1ms (Views: 0.2ms | ActiveRecord: 0.0ms)
I, [2019-05-20T22:13:25.112308 #1073-47434002225460] INFO – : thread#-: Start import…
I, [2019-05-20T22:13:25.112712 #1073-47434002225460] INFO – : thread#-: POST: https://help.uii.ac.id/otrs/public.pl?Action=ZammadMigrator
I, [2019-05-20T22:13:25.112796 #1073-47434002225460] INFO – : thread#-: PARAMS: {:Action=>“ZammadMigrator”, :Key=>“UvGREanTczAdBsX2E3ZSlrTAnukyTMeCpN8YdM7I”}
I, [2019-05-20T22:13:25.526818 #1073-47434002225460] INFO – : thread#-: loading SysConfig…
I, [2019-05-20T22:13:25.526989 #1073-47434002225460] INFO – : thread#-: POST: https://help.uii.ac.id/otrs/public.pl?Action=ZammadMigrator
I, [2019-05-20T22:13:25.527061 #1073-47434002225460] INFO – : thread#-: PARAMS: {:Subaction=>“Export”, :Object=>“SysConfig”, :Limit=>"", :Offset=>"", :Diff=>0, :Action=>“ZammadMigrator”, :Key=>“UvGREanTczAdBsX2E3ZSlrTAnukyTMeCpN8YdM7I”}
I, [2019-05-20T22:13:26.445083 #1073-47434002225460] INFO – : Setting.set(‘http_type’, “https”)
I, [2019-05-20T22:13:26.451977 #1073-47434002225460] INFO – : Setting.set(‘organization’, “Universitas Islam Indonesia”)
I, [2019-05-20T22:13:26.462153 #1073-47434002225460] INFO – : Setting.set(‘system_id’, “00”)
I, [2019-05-20T22:13:26.466363 #1073-47434002225460] INFO – : Setting.set(‘ticket_hook’, “Ticket#”)
I, [2019-05-20T22:13:26.473581 #1073-47434002225460] INFO – : Setting.set(‘ticket_number’, “Ticket::Number::Date”)
I, [2019-05-20T22:13:26.481264 #1073-47434002225460] INFO – : Setting.set(‘ticket_number_date’, {:checksum=>true})
I, [2019-05-20T22:13:26.481486 #1073-47434002225460] INFO – : thread#-: loading DynamicField…
I, [2019-05-20T22:13:26.483652 #1073-47434002225460] INFO – : thread#-: POST: https://help.uii.ac.id/otrs/public.pl?Action=ZammadMigrator
I, [2019-05-20T22:13:26.483738 #1073-47434002225460] INFO – : thread#-: PARAMS: {:Subaction=>“Export”, :Object=>“DynamicField”, :Limit=>"", :Offset=>"", :Diff=>0, :Action=>“ZammadMigrator”, :Key=>“UvGREanTczAdBsX2E3ZSlrTAnukyTMeCpN8YdM7I”}
I, [2019-05-20T22:13:27.076274 #1073-47434002225460] INFO – : thread#-: loading State…
I, [2019-05-20T22:13:27.076467 #1073-47434002225460] INFO – : thread#-: POST: https://help.uii.ac.id/otrs/public.pl?Action=ZammadMigrator
I, [2019-05-20T22:13:27.076555 #1073-47434002225460] INFO – : thread#-: PARAMS: {:Subaction=>“Export”, :Object=>“State”, :Limit=>"", :Offset=>"", :Diff=>0, :Action=>“ZammadMigrator”, :Key=>“UvGREanTczAdBsX2E3ZSlrTAnukyTMeCpN8YdM7I”}
I, [2019-05-20T22:13:27.405933 #1073-47434002225460] INFO – : thread#-: update Ticket::State.find_by(id: 1)
E, [2019-05-20T22:13:27.409548 #1073-47434002225460] ERROR – : undefined method id' for nil:NilClass (NoMethodError) /opt/zammad/lib/import/otrs/state.rb:63:instate_type_id’
/opt/zammad/lib/import/otrs/state.rb:56:in map' /opt/zammad/lib/import/otrs/state.rb:25:inimport’
/opt/zammad/lib/import/otrs/state.rb:19:in initialize' /opt/zammad/lib/import/base_factory.rb:34:innew’
/opt/zammad/lib/import/base_factory.rb:34:in create_instance' /opt/zammad/lib/import/base_factory.rb:10:inblock in import_action’
/opt/zammad/lib/import/base_factory.rb:38:in each' /opt/zammad/lib/import/base_factory.rb:38:inimport_loop’
/opt/zammad/lib/import/otrs/state_factory.rb:22:in import_loop' /opt/zammad/lib/import/base_factory.rb:7:inimport_action’
/opt/zammad/lib/import/transaction_factory.rb:10:in block in import' /opt/zammad/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.6.2/lib/active_record/connection_adapters/abstract/database_statements.rb:235:inblock in transaction’
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.6.2/lib/active_record/connection_adapters/abstract/transaction.rb:194:in block in within_new_transaction' /opt/zammad/vendor/ruby-2.4.4/lib/ruby/2.4.0/monitor.rb:214:inmon_synchronize’
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.6.2/lib/active_record/connection_adapters/abstract/transaction.rb:191:in within_new_transaction' /opt/zammad/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.6.2/lib/active_record/connection_adapters/abstract/database_statements.rb:235:intransaction’
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.6.2/lib/active_record/transactions.rb:210:in transaction' /opt/zammad/lib/import/transaction_factory.rb:9:inimport’
/opt/zammad/lib/import/otrs.rb:146:in import_action' /opt/zammad/lib/import/otrs.rb:71:inimport’
/opt/zammad/lib/import/otrs.rb:160:in updateable_objects' /opt/zammad/lib/import/otrs.rb:41:instart’
/opt/zammad/lib/import/otrs/async.rb:27:in start_bg' /opt/zammad/vendor/bundle/ruby/2.4.0/gems/delayed_job-4.1.3/lib/delayed/performable_method.rb:26:inperform’
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/delayed_job-4.1.3/lib/delayed/backend/base.rb:81:in block in invoke_job' /opt/zammad/vendor/bundle/ruby/2.4.0/gems/delayed_job-4.1.3/lib/delayed/lifecycle.rb:61:inblock in initialize’
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/delayed_job-4.1.3/lib/delayed/lifecycle.rb:66:in execute' /opt/zammad/vendor/bundle/ruby/2.4.0/gems/delayed_job-4.1.3/lib/delayed/lifecycle.rb:40:inrun_callbacks’
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/delayed_job-4.1.3/lib/delayed/backend/base.rb:78:in invoke_job' /opt/zammad/vendor/bundle/ruby/2.4.0/gems/delayed_job-4.1.3/lib/delayed/worker.rb:230:inblock (2 levels) in run’
/opt/zammad/vendor/ruby-2.4.4/lib/ruby/2.4.0/timeout.rb:93:in block in timeout' /opt/zammad/vendor/ruby-2.4.4/lib/ruby/2.4.0/timeout.rb:103:intimeout’
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/delayed_job-4.1.3/lib/delayed/worker.rb:230:in block in run' /opt/zammad/vendor/ruby-2.4.4/lib/ruby/2.4.0/benchmark.rb:308:inrealtime’
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/delayed_job-4.1.3/lib/delayed/worker.rb:229:in run' /opt/zammad/vendor/bundle/ruby/2.4.0/gems/delayed_job-4.1.3/lib/delayed/worker.rb:312:inblock in reserve_and_run_one_job’
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/delayed_job-4.1.3/lib/delayed/lifecycle.rb:61:in block in initialize' /opt/zammad/vendor/bundle/ruby/2.4.0/gems/delayed_job-4.1.3/lib/delayed/lifecycle.rb:66:inexecute’
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/delayed_job-4.1.3/lib/delayed/lifecycle.rb:40:in run_callbacks' /opt/zammad/vendor/bundle/ruby/2.4.0/gems/delayed_job-4.1.3/lib/delayed/worker.rb:312:inreserve_and_run_one_job’
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/delayed_job-4.1.3/lib/delayed/worker.rb:213:in block in work_off' /opt/zammad/vendor/bundle/ruby/2.4.0/gems/delayed_job-4.1.3/lib/delayed/worker.rb:212:intimes’
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/delayed_job-4.1.3/lib/delayed/worker.rb:212:in work_off' /opt/zammad/app/models/scheduler.rb:367:inblock (3 levels) in worker’
/opt/zammad/vendor/ruby-2.4.4/lib/ruby/2.4.0/benchmark.rb:308:in realtime' /opt/zammad/app/models/scheduler.rb:365:inblock (2 levels) in worker’
/opt/zammad/app/models/scheduler.rb:361:in loop' /opt/zammad/app/models/scheduler.rb:361:inblock in worker’
/opt/zammad/vendor/bundle/ruby/2.4.0/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context’
I, [2019-05-20T22:13:27.412081 #1073-47434002225460] INFO – : 2019-05-20T22:13:27-0400: [Worker(host:zammad-server pid:1073)] Job Module#start_bg (id=21) COMPLETED after 4.7563

form the command line :

irb(main):004:0> Import::OTRS.start
thread#-: Start import...
thread#-: POST: https://help.uii.ac.id/otrs/public.pl?Action=ZammadMigrator
thread#-: PARAMS: {:Action=>"ZammadMigrator", :Key=>"UvGREanTczAdBsX2E3ZSlrTAnukyTMeCpN8YdM7I"}
thread#-: loading SysConfig...
thread#-: POST: https://help.uii.ac.id/otrs/public.pl?Action=ZammadMigrator
thread#-: PARAMS: {:Subaction=>"Export", :Object=>"SysConfig", :Limit=>"", :Offset=>"", :Diff=>0, :Action=>"ZammadMigrator", :Key=>"UvGREanTczAdBsX2E3ZSlrTAnukyTMeCpN8YdM7I"}
Setting.reset_change_id: set new cache, 576058105
Setting.set('http_type', "https")
Setting.reset_change_id: set new cache, 46043952
Setting.set('organization', "Universitas Islam Indonesia")
Setting.reset_change_id: set new cache, 745870822
Setting.set('system_id', "00")
Setting.reset_change_id: set new cache, 221465947
Setting.set('ticket_hook', "Ticket#")
Setting.reset_change_id: set new cache, 869140212
Setting.set('ticket_number', "Ticket::Number::Date")
Setting.reset_change_id: set new cache, 312913428
Setting.set('ticket_number_date', {:checksum=>true})
thread#-: loading DynamicField...
thread#-: POST: https://help.uii.ac.id/otrs/public.pl?Action=ZammadMigrator
thread#-: PARAMS: {:Subaction=>"Export", :Object=>"DynamicField", :Limit=>"", :Offset=>"", :Diff=>0, :Action=>"ZammadMigrator", :Key=>"UvGREanTczAdBsX2E3ZSlrTAnukyTMeCpN8YdM7I"}
-- add_column("tickets", "itsm_criticality", :string, {:limit=>255, :null=>true})
   -> 0.0716s
-- add_column("tickets", "itsm_impact", :string, {:limit=>255, :null=>true})
   -> 0.0014s
thread#-: loading State...
thread#-: POST: https://help.uii.ac.id/otrs/public.pl?Action=ZammadMigrator
thread#-: PARAMS: {:Subaction=>"Export", :Object=>"State", :Limit=>"", :Offset=>"", :Diff=>0, :Action=>"ZammadMigrator", :Key=>"UvGREanTczAdBsX2E3ZSlrTAnukyTMeCpN8YdM7I"}
thread#-: update Ticket::State.find_by(id: 1)
NoMethodError: undefined method `id' for nil:NilClass
        from lib/import/otrs/state.rb:63:in `state_type_id'
        from lib/import/otrs/state.rb:56:in `map'
        from lib/import/otrs/state.rb:25:in `import'
        from lib/import/otrs/state.rb:19:in `initialize'
        from lib/import/base_factory.rb:34:in `new'
        from lib/import/base_factory.rb:34:in `create_instance'
        from lib/import/base_factory.rb:10:in `block in import_action'
        from lib/import/base_factory.rb:38:in `each'
        from lib/import/base_factory.rb:38:in `import_loop'
        from lib/import/otrs/state_factory.rb:22:in `import_loop'
        from lib/import/base_factory.rb:7:in `import_action'
        from lib/import/transaction_factory.rb:10:in `block in import'
        from lib/import/transaction_factory.rb:9:in `import'
        from lib/import/otrs.rb:146:in `import_action'
        from lib/import/otrs.rb:71:in `import'
        from lib/import/otrs.rb:160:in `updateable_objects'
        from lib/import/otrs.rb:41:in `start'
        from (irb):4

@thorsteneckel can you help me to fix this issue?

Please see this post:

The same basically affects you as well.

I have the strange feeling that @imam21 and @imam32 know each other :nerd_face: We should close this topic here as a duplicate because the other topic contains more information and the proposed solution.