Download My Posts failed

User informed me they could not download their posts, I tried as well (button in user/activity), I get a message saying “Data export failed” and this is in the logs:

Message

Job exception: undefined method `name' for nil:NilClass

Backtrace

/var/www/discourse/app/jobs/regular/export_csv_file.rb:226:in `get_user_archive_fields'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:66:in `block in user_archive_export'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.8/lib/active_record/relation/delegation.rb:46:in `each'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.8/lib/active_record/relation/delegation.rb:46:in `each'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:65:in `user_archive_export'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:48:in `each'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:48:in `block in execute'
/usr/local/lib/ruby/2.3.0/csv.rb:1282:in `open'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:46:in `execute'
/var/www/discourse/app/jobs/base.rb:154:in `block (2 levels) in perform'

Env
hostname	hetzner1-smf
process_id	1372
application_version	ae8bd6c8258f729025656705545a45992fa82f9c
current_db	default
current_hostname	forum.moparisthebest.com
job	Jobs::ExportCsvFile
problem_db	default
	
opts	null
entity	user_archive
user_id	1
current_site_id	default

I am on current discourse stable v1.8.4 installed the supported way through docker on ubuntu.

If this is a bug (can we repro @techapj?) we would only fix it in the current 1.9 beta.

2 Likes

I am unable to repro this on tests-passed branch.

@moparisthebest if you wish to change the tracking branch see this topic:

I just upgraded to the tests-passed branch, but I get the same error, currently on v1.9.0.beta5 +73:

Message

Job exception: undefined method `name' for nil:NilClass

Backtrace

/var/www/discourse/app/jobs/regular/export_csv_file.rb:226:in `get_user_archive_fields'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:66:in `block in user_archive_export'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.9/lib/active_record/relation/delegation.rb:46:in `each'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.9/lib/active_record/relation/delegation.rb:46:in `each'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:65:in `user_archive_export'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:48:in `each'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:48:in `block in execute'
/usr/local/lib/ruby/2.3.0/csv.rb:1282:in `open'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:46:in `execute'
/var/www/discourse/app/jobs/base.rb:153:in `block (2 levels) in perform'

Env
hostname	hetzner1-smf
process_id	118
application_version	aab0b06cbe20535abcc484d7b0cd67d8fe033867
current_db	default
current_hostname	forum.moparisthebest.com
job	Jobs::ExportCsvFile
problem_db	default
	
opts	null
entity	user_archive
user_id	1
current_site_id	default

So the original reporting user made a new account, made a post, and export posts worked for that new account. My only thought is this forum and users were imported from an SMF forum using the included importer, did it not do something correctly?

Looks like the import did something incorrect with the data, then.

1 Like

The error you are seeing is most probably because of incorrect ID saved for a parent category. I just pushed a fix to handle the error and continue exporting archive.

https://github.com/discourse/discourse/commit/e993d53260d465d02fee7d70841dc6108fa56f0a

2 Likes

Thanks for the patch!

Is there a way to pull just that commit into my discourse without changing the version from tests-passed to master? Alternatively, when will that be in tests-passed? :slight_smile:

It’s already in tests-passed. :wink:

1 Like

Ah, I couldn’t upgrade in the ui, but command line did just fine :slight_smile:

Also great news, that fixed it and exports now work. Would it be worth trying to fix the missing parent category problem somehow too?