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

Import of Hipchat export (tar.gz) is failing with invalid format #11355

Closed
icerootsvw opened this issue Jul 5, 2018 · 27 comments
Closed

Import of Hipchat export (tar.gz) is failing with invalid format #11355

icerootsvw opened this issue Jul 5, 2018 · 27 comments
Assignees

Comments

@icerootsvw
Copy link

Rocket.Chat Version: 0.65.1 (snap installation)
Host-System: Debian GNU Linux Stretch

I created an export of my current Hipchat Installation (Atlassian HipChat 2.2.9 (2018.01.23.110010)). This is a standalone installation and not the cloud version.

The export was an AES encrypted file (around 950MB)
hipchat-2018-07-05_09-30-12.tar.gz.aes: openssl enc'd data with salted password

I decrypted the file with
openssl aes-256-cbc -d -in /home/mbasse/hipchat-2018-07-05_09-30-12.tar.gz.aes -out /home/mbasse/hipchat-2018-07-05_09-30-12.tar.gz -pass pass:******

So i got the tar.gz file
hipchat-2018-07-05_09-30-12.tar.gz: gzip compressed data, was "hipchat-2018-07-05_09-30-12.tar", last modified: Thu Jul 5 09:30:12 2018, max compression

I was able to open the tar.gz file with my local file browser. I was also able to extract it.

I tried to import the file with these 2 options (because i dont know what the difference between Hipchat and Hipchat Enterprise is
FQDN/admin/import/prepare/hipchat
and also
FQDN/admin/import/prepare/hipchatenterprise

In both cases i got after some seconds the error message "Ungültiges Importformat" (english: invalidf import format)

I hope these information are useful. If you need further information please feel free to ask.

Greetings from Germany
Michael

@icerootsvw
Copy link
Author

as i just figured out, there is a new hipchat version (2.4.0). I will update the system and will recheck the import

@icerootsvw
Copy link
Author

even with Hipchat 2.4.0 and the export from that system i am getting the exact same error

@piotrkochan
Copy link
Contributor

I'm getting a lot of errors:

I20180717-09:55:06.290(2)? Exception in callback of async function: SyntaxError: Unexpected token , in JSON at position 5
I20180717-09:55:06.290(2)?     at JSON.parse (<anonymous>:null:null)
I20180717-09:55:06.291(2)?     at stream.on.Meteor.bindEnvironment.chunk (/media/sdfsdfsdf/Rocket.Chat/.meteor/local/build/programs/server/packages/rocketchat_importer-hipchat-enterprise.js:125:31)
I20180717-09:55:06.291(2)?     at runWithEnvironment (packages/meteor.js:1238:24)

I've looked into source and debugged packages/rocketchat-importer-hipchat-enterprise/server/importer.js. It is failing on this JSON.parse(chunk):

const promise = new Promise((resolve, reject) => {
			this.extract.on('entry', Meteor.bindEnvironment((header, stream, next) => {
				if (header.name.indexOf('.json') !== -1) {
					const info = this.path.parse(header.name);

					stream.on('data', Meteor.bindEnvironment((chunk) => {
						this.logger.debug(`Processing the file: ${ header.name }`);
						const file = JSON.parse(chunk);

because chunk is invalid JSON like:

 y": "private",       "room_admins": [
    452
      ],
  "topic": ""
    }
  },

Maybe it is problem with 'tar-stream' package.

@jakob-lundberg
Copy link

It looks like the importer takes chunks out of the tar stream and tries to JSON parse them. But to get correct JSON the entire file is needed at once. Maybe the the chunks first needs to be collected in a temp file and then parsed?

@piotrkochan
Copy link
Contributor

piotrkochan commented Jul 30, 2018 via email

@piotrkochan
Copy link
Contributor

piotrkochan commented Jul 30, 2018 via email

@jakob-lundberg
Copy link

Well loading everything into memory is also possible. Here is how it could work
jakob-lundberg@dd770b2

@piotrkochan
Copy link
Contributor

Still, this is very memory consuming way. I think that is would be better to use JSON Stream, something in the way like:

this.extract.on('entry', Meteor.bindEnvironment((header, stream, next) => {
[....]
stream
    .pipe(this.JSONStream.parse('*'))
    .on('data', Meteor.bindEnvironment((chunk) => {
        console.log(chunk); // {User: ...} or {Room: ...} etc
    })

In this approach tar-stream streams file contents while Json Strem tries to assemble them on the fly. "header" is still available so could be used to detect which file is being read.

@icerootsvw
Copy link
Author

Is there something how i can support you (i am not a developer).
Maybe this is interesting for you. Hipchat will be canceled and Attlassian will switch to slack in 02.2019.

https://www.theverge.com/2018/7/26/17619482/slack-hipchat-acquisition-stride-atlassian-partnership-microsoft-teams-competition

So i guess there will be more users in the next months which are migrating from Hipchat Server to Rocket.Chat (like we are doing)

@jakob-lundberg
Copy link

@piotrkochan Will you make a pull request with your solution? Otherwise I can make one with my simple "load entire file into memory" approach.

@gf-raveinid
Copy link

Rocket.chat
Version | 0.69.1

I'm still getting invalid import file type error. New export from Atlassian HipChat 2.4.1 (2018.07.19.134050)
[34mI20180911-22:17:43.744(0) rocketchat_logger rocketchat_logger.js:278 �[34mMeteor ➔ method setupImporter -> userId: sebDhFRBN9hdySJja , arguments: [ 'hipchatenterprise' ]
�[34mI20180911-22:17:43.770(0) rocketchat_logger rocketchat_logger.js:278 �[34mMeteor ➔ method getImportProgress -> userId: sebDhFRBN9hdySJja , arguments: [ 'hipchatenterprise' ]
�[34mI20180911-22:18:00.170(0) rocketchat_logger rocketchat_logger.js:278 �[34mMeteor ➔ method prepareImport -> userId: sebDhFRBN9hdySJja , arguments: [ 'hipchatenterprise', '', 'application/gzip', 'hipchat-2018-09-11_21-58-51.tar.gz' ]
�[34mI20180911-22:18:00.174(0) Exception while invoking method 'prepareImport' TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object. at Function.Buffer.from (buffer.js:183:11) at new Buffer (buffer.js:158:17) at HipChatEnterpriseImporter.prepare (/app/bundle/programs/server/packages/rocketchat_importer.js:221:41) at HipChatEnterpriseImporter.prepare (/app/bundle/programs/server/packages/rocketchat_importer-hipchat-enterprise.js:139:11) at MethodInvocation.prepareImport (/app/bundle/programs/server/packages/rocketchat_importer.js:812:39) at MethodInvocation.methodsMap.(anonymous function) (/app/bundle/programs/server/packages/rocketchat_lib.js:2496:36) at MethodInvocation.methodMap.(anonymous function) (packages/rocketchat_monitoring.js:2731:30) at maybeAuditArgumentChecks (/app/bundle/programs/server/packages/ddp-server.js:1877:12) at DDP._CurrentMethodInvocation.withValue (/app/bundle/programs/server/packages/ddp-server.js:902:126) at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1186:12) at DDPServer._CurrentWriteFence.withValue (/app/bundle/programs/server/packages/ddp-server.js:902:98) at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1186:12) at Promise (/app/bundle/programs/server/packages/ddp-server.js:902:46) at new Promise (:null:null) at Session.method (/app/bundle/programs/server/packages/ddp-server.js:875:23) at /app/bundle/programs/server/packages/ddp-server.js:754:85

@piotrkochan
Copy link
Contributor

@jakob-lundberg sorry I can't

@artem-levashov
Copy link

artem-levashov commented Sep 24, 2018

i see same error
Exception while invoking method 'prepareImport' TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.

It happens when i try to upload 950Mb file.

But when i try to upload 24Mb then this stage is ok. but then everything stops on following
Sep 24 04:55:38 xloo-rchat rocketchat: rocketchat_logger rocketchat_logger.js:278 #33[34mHipChat (tar.gz) Importer ➔ debug#033[39m HipChat (tar.gz) is now at importer_preparing_started.
Sep 24 04:55:38 xloo-rchat rocketchat: rocketchat_logger rocketchat_logger.js:278 #33[34mHipChat (tar.gz) Importer ➔ debug#033[39m Processing the file: users.json
Sep 24 04:55:38 xloo-rchat rocketchat: rocketchat_logger rocketchat_logger.js:278 #33[34mHipChat (tar.gz) Importer ➔ debug#033[39m HipChat (tar.gz) is now at importer_preparing_users.
Sep 24 04:55:38 xloo-rchat rocketchat: rocketchat_logger rocketchat_logger.js:278 #33[34mHipChat (tar.gz) Importer ➔ debug#033[39m Processing the file: rooms.json
Sep 24 04:55:38 xloo-rchat rocketchat: rocketchat_logger rocketchat_logger.js:278 #33[34mHipChat (tar.gz) Importer ➔ debug#033[39m HipChat (tar.gz) is now at importer_preparing_channels.
Sep 24 04:55:38 xloo-rchat rocketchat: rocketchat_logger rocketchat_logger.js:278 #33[34mHipChat (tar.gz) Importer ➔ debug#033[39m HipChat (tar.gz) is now at importer_preparing_messages.
Sep 24 04:55:38 xloo-rchat rocketchat: rocketchat_logger rocketchat_logger.js:278 #33[35mHipChat (tar.gz) Importer ➔ warn#033[39m The loaded users count 268, the loaded rooms 217, and the loaded messages 0
Sep 24 04:55:38 xloo-rchat rocketchat: rocketchat_logger rocketchat_logger.js:278 #33[34mHipChat (tar.gz) Importer ➔ debug#033[39m HipChat (tar.gz) is now at importer_import_failed.

My small archive contains only users and rooms and no massages and no attachments

@artem-levashov
Copy link

i found in the code if (tempUsers.length === 0 || tempRooms.length === 0 || messagesCount === 0) {
... return }

it looks like i canot import without messages. but with messages my file is too large. i will try to copy several messages from be archive to small

@piotrkochan
Copy link
Contributor

piotrkochan commented Sep 24, 2018 via email

@artem-levashov
Copy link

with history of only 1 room import works and i`m able now to select what i want to import (but unfortunatly here is also problem - Buttons Uncheck deleted and archived are not working - need to unchek each item manualy.)

so here is still big problem for me how to transfer history. my full history wihtout attachments has size 950Mb in archive - it is about 3 years of using hipchat. it looks like Rocket do not wait while such big size will be uploaded. I think a lot of people needs it to work - the February is close :-)

@manuelbliemel
Copy link

I'm stuck with the same problem.
Even without attachments the import does not work.
Has anybody managed to solve the issue?

@marcinkorzycki
Copy link

Bump - the same issue here.

@piotrkochan
Copy link
Contributor

@marcinkorzycki RocketChat 0.73.0 introduced some Hipchat Enterprise importer improvements (#12985), did You tried it?

@jandeger
Copy link

I have the same problem when trying to import from Stride. I have a tar,gz file that I can see all users, rooms etc. I can select the file and in the GUI I see all users and rooms but the buttons doesn't work. Please try to fix this ASAP since only a few weeks left before HipChat/Stride is closed and Slack is not an option for us.
I've updated to latest version 0.73.2 but still the same problem.

@marcoj
Copy link

marcoj commented Jan 23, 2019

We're having exactly the same issue. any news on this? The Stride end date is coming close and Rocket is exactly what we need...

@artem-levashov
Copy link

artem-levashov commented Jan 23, 2019

We was able to move from hipchat to rocket only by longway workaround. We have dowloaded history by small periods. Each file was no more then 100mb maybe less. We spent about 1.5 weeks to upload history of 2 years.

@marcoj
Copy link

marcoj commented Jan 23, 2019

Well, we're trying to import only the chat rooms + users and that's around a 2mb file... so file size is not the issue

@jandeger
Copy link

In the new version 0.74 that is coming I saw there was something fixed for HipChat import. From the support they told us that they only support import from HipChat not Stride, I think it's the same format of the export file though. Anyway, we have give up and are moving to Slack, quite good offer the first year for the paid plan.

@artem-levashov
Copy link

artem-levashov commented Jan 23, 2019

Check room topics. We had problem with import when russian letters was used in room name. I had to rename rooms before transfer. Dont forget to chekc deleted rooms also.

@artem-levashov
Copy link

artem-levashov commented Jan 23, 2019

Antoher problem was with users with same email but different names. Check that you dont have inactive users with same emailn as active

@Hudell
Copy link
Contributor

Hudell commented Feb 18, 2019

All known hipchat import issues have been fixed with the release of version 0.74.3. If anybody runs into any issue with it, please open a new issue.

@Hudell Hudell closed this as completed Feb 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests