algolia / algolia/jekyll-algolia

build fails with "Error: no implicit conversion of String into Integer" but --dry-run flag says "Indexing Complete" instead

Open
#162 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
211
Forks
35
PR merge metrics
No merged PRs in 30d

Description

**EDIT** I've found the cause/solution to the bug I initially reported, so am adjusting this to a feature request:

## I want to suggest a feature:

**Settings should be validated before attempting to push data** and meaningful feedback provided to allow someone to adjust bad config.

### What is your use case for such a feature?

The original issue is fully outlined below. To summarize: a setting in the config was in the wrong format (a number was wrapped in quotes so was treated as a string instead of the number expected by code), however the error was a generic conversion error, which made troubleshooting difficult.

In case someone else encounters this issue, I'm leaving the "bug details" below.

# Original "bug report" below

## I want to report a bug:

`--dry-run` flag gives the "Indexing Complete" status but actual build fails with error: `Error: no implicit conversion of String into Integer`

### What is the current behavior?

Aftger running the command `bundle exec jekyll algolia` I get the following output:

```
Configuration file: E:/Documentation/jekyll-deployment-scripts/jekyll-layout/_config.yml
Processing site...

Progress: |====================================================================|

Progress: |====================================================================|
Settings are already up to date.
Getting list of existing records
Updating records in index stg_help...
Records to delete: 655
Records to add: 1406
jekyll 3.7.4 | Error: no implicit conversion of String into Integer
```

To troubleshoot, I used the `--dry-run` flag (`bundle exec jekyll algolia --dry-run`) which displays "Indexing complete"

```
Configuration file: E:/Documentation/jekyll-deployment-scripts/jekyll-layout/_config.yml
Processing site...

Progress: |====================================================================|

Progress: |====================================================================|
Settings are already up to date.
Getting list of existing records
Updating records in index stg_help...
Records to delete: 655
Records to add: 1406
✔ Indexing complete
```

To troubleshoot further I used the solution mentioned here: https://github.com/algolia/jekyll-algolia/issues/22#issuecomment-353566802

Using the json data file generated by the plugin linked above, I was successfully able to manually upload the whole data set in one go - I assumed that something about the data was off but there were no error messages when I submitted via the "manual upload" option on the web.

At this point, the value of the plugin (auto-updating the right records) is lost to me until I can figure out what setting, frontmatter, or other thing is causing the issue. Is there something I should look for in the content? (e.g. if my frontmatter has numeric properties, is that causing the issue?).

### What is your expected behavior?
I expect either:
1) the `--dry-run` option should produce similar results to the live build.
2) a meaningful error message pointing to what data, line of json, or file caused the failure to upload.

### Ruby version used:
This issue is consistent on two different platforms building the same content/config files (one's a build server - linux, one's my desktop - windows 10). Here are both ruby versions

windows: ruby 2.6.6p146 (2020-03-31 revision 67876) [x64-mingw32]

linux: ruby 2.5.1p57 (2018-03-29 revision 63029 [x86_64-linux-gnu]

### Jekyll version used:

windows: jekyll 3.7.4

linux: jekyll 3.8.5

## Cause/Resolution

The issue was due to the setting `indexing_batch_size` in quotes in _config.yml

Broken:
```yaml
algolia:
application_id: "XKCD797" # from account
search_only_api_key: "00000000000000000000000000000000" # from account
index_name: "my_index" # from account
indexing_batch_size: "500" #BROKEN LINE IS HERE
nodes_to_index: 'p,li,blockquote,dd'
files_to_exclude: []
```

Working:
```yml
algolia:
application_id: "XKCD797" # from account
search_only_api_key: "00000000000000000000000000000000" # from account
index_name: "my_index" # from account
indexing_batch_size: 500 #FIXED LINE IS HERE
nodes_to_index: 'p,li,blockquote,dd'
files_to_exclude: []
```

Contributor guide

Open the contributing guide

Research direction

Start with the `bundle exec jekyll algolia` entry point and the `algolia` settings shown in `_config.yml`, especially `indexing_batch_size`; compare live and `--dry-run` behavior. Done means invalid setting types are detected before pushing data and produce meaningful feedback identifying the problematic configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
jekyll, ruby, yaml
Domain
build-system, search
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.