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

Importing Records.json fails with "not found" errors on every attribute #663

Open
rswafford opened this issue Jan 14, 2025 · 2 comments
Open

Comments

@rswafford
Copy link

OS & Hardware
Docker

Version
v0.22.2

Describe the bug
A clear and concise description of what the bug is.
I have broken my Google Takeout Records.json file up into ~200mb chunks, each is a complete JSON file. Upon executing the rake task like so:
bundle exec rake import:big_file['tmp/imports/watched/Records_001.json', '[email protected]']
Note: I am using my correct email address... I have stripped it from the command here for privacy. I've also noticed that rake doesn't like normal single quotes -- I have to use the backtick character around the path and email address for it to recognize.

The console quickly fills up with error messages a la:
image

Expected behavior
I'd expect this to run and import all of my location history.

What am I missing? Seems like the file importer is bugged in this release maybe? A sample of my JSON file input is below:

{
  "locations": [{
    "latitudeE7": 429641580,
    "longitudeE7": -878563048,
    "accuracy": 34,
    "activity": [{
      "activity": [{
        "type": "UNKNOWN",
        "confidence": 87
      }, {
        "type": "STILL",
        "confidence": 7
      }, {
        "type": "IN_VEHICLE",
        "confidence": 5
      }],
      "timestamp": "2014-02-10T14:10:34.855Z"
    }],
    "source": "WIFI",
    "deviceTag": 69524134,
    "timestamp": "2014-02-10T14:10:19.132Z"
  }, {
    "latitudeE7": 429642580,
    "longitudeE7": -878563314,
    "accuracy": 35,
    "source": "WIFI",
    "deviceTag": 69524134,
    "timestamp": "2014-02-10T14:11:20.918Z"
  }, {
    "latitudeE7": 429643471,
    "longitudeE7": -878562903,
    "accuracy": 48,
    "source": "WIFI",
    "deviceTag": 69524134,
    "timestamp": "2014-02-10T14:12:20.240Z"
  }, {
    "latitudeE7": 429641833,
    "longitudeE7": -878563427,
    "accuracy": 63,
    "activity": [{
      "activity": [{
        "type": "STILL",
        "confidence": 87
      }, {
        "type": "UNKNOWN",
        "confidence": 7
      }, {
        "type": "IN_VEHICLE",
        "confidence": 4
      }],
      "timestamp": "2014-02-10T14:14:10.200Z"
    }],
    "source": "WIFI",
    "deviceTag": 69524134,
    "timestamp": "2014-02-10T14:13:49.485Z"
  }, {
    "latitudeE7": 429644235,
    "longitudeE7": -878563269,
    "accuracy": 48,
    "activity": [{
      "activity": [{
        "type": "TILTING",
        "confidence": 100
      }],
      "timestamp": "2014-02-10T14:15:22.888Z"
    }],
    "source": "WIFI",
    "deviceTag": 69524134,
    "timestamp": "2014-02-10T14:15:01.948Z"
  }]
}
@PoBruno
Copy link

PoBruno commented Jan 20, 2025

I have exactly the same problem, I exported json through the google maps android app and passed it to the host.

plza@dawarich:~$ docker exec -it dawarich_app sh
/var/app # bundle exec rake import:big_file['tmp/imports/Records.json','[email protected]']
[dotenv] Set DATABASE_PORT
[dotenv] Loaded .env.development
D, [2025-01-20T05:00:42.292031 #1142] DEBUG -- :   User Load (39.1ms)  SELECT "users".* FROM "users" WHERE "users"."email" = $1 LIMIT $2  [["email", "[email protected]"], ["LIMIT", 1]]
D, [2025-01-20T05:00:42.294723 #1142] DEBUG -- :   ↳ app/services/tasks/imports/google_records.rb:9:in `initialize'
D, [2025-01-20T05:00:42.581900 #1142] DEBUG -- :   TRANSACTION (0.2ms)  BEGIN
D, [2025-01-20T05:00:42.596591 #1142] DEBUG -- :   ↳ app/services/tasks/imports/google_records.rb:26:in `create_import'
D, [2025-01-20T05:00:42.599486 #1142] DEBUG -- :   Import Create (21.5ms)  INSERT INTO "imports" ("name", "user_id", "source", "created_at", "updated_at", "raw_points", "doubles", "processed", "raw_data", "points_count") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) RETURNING "id"  [["name", "tmp/imports/Records.json"], ["user_id", 1], ["source", 2], ["created_at", "2025-01-20 05:00:42.575840"], ["updated_at", "2025-01-20 05:00:42.575840"], ["raw_points", 0], ["doubles", 0], ["processed", 0], ["raw_data", nil], ["points_count", 0]]
D, [2025-01-20T05:00:42.602291 #1142] DEBUG -- :   ↳ app/services/tasks/imports/google_records.rb:26:in `create_import'
D, [2025-01-20T05:00:42.606742 #1142] DEBUG -- :   TRANSACTION (1.7ms)  COMMIT
D, [2025-01-20T05:00:42.607553 #1142] DEBUG -- :   ↳ app/services/tasks/imports/google_records.rb:26:in `create_import'
D, [2025-01-20T05:00:42.607964 #1142] DEBUG -- : Importing tmp/imports/Records.json for [email protected], file size is 32330606... This might take a while, have patience!
rake aborted!
NoMethodError: undefined method `each' for nil (NoMethodError)

    json_data['locations'].each do |json|
                          ^^^^^
/var/app/app/services/tasks/imports/google_records.rb:34:in `schedule_import_jobs'
/var/app/app/services/tasks/imports/google_records.rb:19:in `call'
/var/app/lib/tasks/import.rake:9:in `block (2 levels) in <main>'
/var/app/vendor/bundle/ruby/3.3.0/gems/rake-13.2.1/exe/rake:27:in `<top (required)>'
/usr/local/bundle/gems/bundler-2.5.21/lib/bundler/cli/exec.rb:58:in `load'
/usr/local/bundle/gems/bundler-2.5.21/lib/bundler/cli/exec.rb:58:in `kernel_load'
/usr/local/bundle/gems/bundler-2.5.21/lib/bundler/cli/exec.rb:23:in `run'
/usr/local/bundle/gems/bundler-2.5.21/lib/bundler/cli.rb:455:in `exec'
/usr/local/bundle/gems/bundler-2.5.21/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
/usr/local/bundle/gems/bundler-2.5.21/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/bundle/gems/bundler-2.5.21/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
/usr/local/bundle/gems/bundler-2.5.21/lib/bundler/cli.rb:35:in `dispatch'
/usr/local/bundle/gems/bundler-2.5.21/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
/usr/local/bundle/gems/bundler-2.5.21/lib/bundler/cli.rb:29:in `start'
/usr/local/bundle/gems/bundler-2.5.21/exe/bundle:28:in `block in <top (required)>'
/usr/local/bundle/gems/bundler-2.5.21/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/usr/local/bundle/gems/bundler-2.5.21/exe/bundle:20:in `<top (required)>'
/usr/local/bundle/bin/bundle:25:in `load'
/usr/local/bundle/bin/bundle:25:in `<main>'
Tasks: TOP => import:big_file
(See full trace by running task with --trace)
/var/app #

@Freika
Copy link
Owner

Freika commented Jan 22, 2025

@rswafford I had no problems importing your sample, so the issue might be in the other part of the file.

@PoBruno Can't say much without a file to debug

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

3 participants