Graphcool / graphcool-framework

Apache License 2.0
1.77k stars 131 forks source link

Can't import data using CLI #478

Closed niwaa closed 6 years ago

niwaa commented 6 years ago

This is a pretty big issue for me to use GF for production, as I can't import any exported data right now.

CLI version: graphcool-framework/0.11.5 (darwin-x64) node-v9.5.0 Environment: Mac OS 10

1- With an exported zip directly from the graphcool export CLI.

graphcool import --source export.zip --target my_target

Results :

Unzipping... ⣻ Error: invalid signature: 0x80014 at /usr/local/lib/node_modules/graphcool/node_modules/unzip/lib/parse.js:59:13 at runCallback (timers.js:756:18) at tryOnImmediate (timers.js:717:5) at processImmediate [as _immediateCallback] (timers.js:697:5)

2- With an exported zip using graphcool export, unzipped and rezipped using zip.

graphcool import --source export.zip --target my_target

Results :

Unzipping... 517ms Validating data... 8ms

Uploading nodes... Uploading nodes done 0ms

Uploading lists Uploading lists done 0ms

Uploading relations Uploading relations done 1ms

No data is however added in my_target. Both export.zip are around 9-10mb, and contains folders (lists, nodes, relations with json files) Tried my_target to cloud and local target, with exact same results.

rcy commented 6 years ago

Also seeing this error here on import:

Error: invalid signature: 0x80014

rcy commented 6 years ago

FYI: In my case, the offending zip was created on macOS. I moved it to a gnu/linux machine and unzipped and rezipped it there and was able to import it.

niwaa commented 6 years ago

I've tried on linux (DigitalOcean Ubuntu droplet). Exact same fails...

1) graphcool CLI export, then graphcool CLI import of the zip : Error: invalid signature: 0x80014

2) Tried to unzip and re-zip the CLI export: No errors, but 0 nodes are actually imported.

It is very frustrating... anyone knows a workaround to import data?

I've tried the raw import API, it works but only for very small JSON files (like < 3mb), and I've only tested it for nodes, not relations. It would be a pain to break down the files and go this route.

niwaa commented 6 years ago

I think I found a workaround fix:

In : graphcool/node_modules/graphcool-cli-core/dist/commands/import/Importer.js

Replace the node-unzip library with this one: https://github.com/mhr3/unzip-stream (after installing it as a dependency).

// var unzip = require("unzip");
var unzip = require("unzip-stream");

I was able to import 20k sample nodes on mac-os. I will do more testing on my prod data.

timsuchanek commented 6 years ago

Thanks for reporting everybody! We just released a new cli version: graphcool@0.11.6 which uses the unzip-stream library

mcmar commented 6 years ago

@timsuchanek graphcool-framework@0.11.6 still hasn't been published. See here:

$ yarn info graphcool-framework versions
yarn info v1.6.0
warning package.json: No license field
[ '0.11.0-beta.1',
  '0.11.3-beta.1',
  '0.11.3',
  '0.11.4-beta.1',
  '0.11.4-beta.2',
  '0.11.4',
  '0.11.5-alpha.1',
  '0.11.5-alpha.2',
  '0.11.5' ]
✨  Done in 0.17s.
emilbruckner commented 5 years ago

@mcmar Only graphcool has been published, not graphcool-framework

I’m confused too