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

"string indices must be integers" in invoice table #37

Open
Nawanop opened this issue Apr 26, 2021 · 8 comments
Open

"string indices must be integers" in invoice table #37

Nawanop opened this issue Apr 26, 2021 · 8 comments

Comments

@Nawanop
Copy link

Nawanop commented Apr 26, 2021

I have extract data using stitchdata, and it throws error as the topic

here is error logs

2021-04-23 12:25:50,074Z tap - yield j["invoice"]
2021-04-23 12:25:50,074Z tap - TypeError: string indices must be integers
2021-04-23 12:25:50,097Z target - INFO Requests complete, stopping loop
2021-04-23 12:25:50,152Z main - INFO Target exited normally with status 0
2021-04-23 12:25:50,734Z main - INFO [smart-services] event successfully sent to kafka: com.stitchdata.extractionJobFinished [18] at offset None
2021-04-23 12:25:50,735Z main - INFO No tunnel subprocess to tear down
2021-04-23 12:25:50,735Z main - INFO Exit status is: Discovery succeeded. Tap failed with code 1 and error message: "string indices must be integers". Target succeeded

Thank you, for advance

@cirotix
Copy link
Contributor

cirotix commented Apr 27, 2021

(please note that I am not from Stitch nor I am a maintainer of this project)
Hi @Nawanop
Do you have a Relationship Invoices Chargify instance or a Classical Invoices Chargify instance?
If you don't know :

  • your instance is newer than 2018 it should be RelationShip Invoices
  • you have statements and transactions in Chargify UI : you have Classical Invoice

Also, it is quite difficult to debug as I don't know which version of the code is deployed in Stitch and there is not enough context from your bug report.
There was some changes in the Invoice schema some time ago fdef252 and more specifically some field that have been converted from integer to string (and the other way also). It could be that Stitch has recently updated their code to this version, hence the trouble (the target expects some integers but now strings are sent by Stitch).

Would you be able to run this tap directly (without using Stitch) to see if you have the problem? This would be the best way to debug. Otherwise I would suggest to contact Stitch support.

@Nawanop
Copy link
Author

Nawanop commented May 1, 2021

@cirotix Hello again, I just get addition logs from stitch for more detail

2021-04-27 05:06:14,867Z tap - INFO invoices: Starting sync
2021-04-27 05:06:14,867Z tap - INFO GET request to https://xxxxxxx.chargify.com/invoices.json?page=1&per_page=100&start_date=2020-04-22&direction=asc
[ ... ]
2021-04-27 05:06:15,544Z tap - INFO replicated 0 records from "invoices" endpoint
2021-04-27 05:06:15,544Z tap - CRITICAL string indices must be integers
2021-04-27 05:06:15,544Z tap - Traceback (most recent call last):
2021-04-27 05:06:15,544Z tap - File "tap-env/bin/tap-chargify", line 33, in
2021-04-27 05:06:15,544Z tap - sys.exit(load_entry_point('tap-chargify==0.0.15', 'console_scripts', 'tap-chargify')())
2021-04-27 05:06:15,544Z tap - File "/code/orchestrator/tap-env/lib/python3.5/site-packages/singer/utils.py", line 229, in wrapped
2021-04-27 05:06:15,544Z tap - return fnc(*args, **kwargs)
2021-04-27 05:06:15,544Z tap - File "/code/orchestrator/tap-env/lib/python3.5/site-packages/tap_chargify/init.py", line 89, in main
2021-04-27 05:06:15,544Z tap - sync(client, parsed_args.catalog, state)
2021-04-27 05:06:15,544Z tap - File "/code/orchestrator/tap-env/lib/python3.5/site-packages/tap_chargify/init.py", line 65, in sync
2021-04-27 05:06:15,544Z tap - counter_value = sync_stream(state, instance)
2021-04-27 05:06:15,544Z tap - File "/code/orchestrator/tap-env/lib/python3.5/site-packages/tap_chargify/sync.py", line 19, in sync_stream
2021-04-27 05:06:15,544Z tap - for (stream, record) in instance.sync(state):
2021-04-27 05:06:15,544Z tap - File "/code/orchestrator/tap-env/lib/python3.5/site-packages/tap_chargify/streams.py", line 107, in sync
2021-04-27 05:06:15,545Z tap - for item in res:
2021-04-27 05:06:15,545Z tap - File "/code/orchestrator/tap-env/lib/python3.5/site-packages/tap_chargify/chargify.py", line 139, in invoices
2021-04-27 05:06:15,545Z tap - yield j["invoice"]

which they said, the error is return from this function

def invoices(self, bookmark=None):
start_date = utils.strptime_with_tz(bookmark).strftime('%Y-%m-%d')
for i in self.get("invoices.json", start_date=start_date, direction="asc"):
for j in i:
yield j["invoice"]

Note: they use last version which version is tap-chargify version 0.0.15

@cirotix
Copy link
Contributor

cirotix commented May 1, 2021

Please reply to the question I asked in my previous comment, otherwise I can't help.

@Nawanop
Copy link
Author

Nawanop commented May 1, 2021

@cirotix sorry, I think it should not be classical invoice.
as you said

you have statements and transactions in Chargify UI : you have Classical Invoice

i didn't see anything like transactions in dashboard, it seperate to another page, here is my dashboard ui
and another thing, first event of this instance is in this year, so I thing It should be relationship invoice

image

@cirotix
Copy link
Contributor

cirotix commented May 1, 2021

Afaik the current code is not compatible with relationship invoices.
In my opinion the code is not ready for an integration into Stitch. It is not efficient and has some bugs.
I have some code in my fork that solves that but I don't know how can merge that in this repo.
I have some code that should be ready for relationship invoices soon. Don't know how and when it will be integrated in Chargify.

@Nawanop
Copy link
Author

Nawanop commented May 2, 2021

@cirotix Thanks for information, I will waiting for update.

@tjiandp
Copy link

tjiandp commented Aug 10, 2021

@Nawanop I got the same error message as you had. Did you find a way to solve this?

@markfilan
Copy link

All the characters of a string have a unique index . This index specifies the position of each character of the string. TypeError: string indices must be integers means an attempt to access a location within a string using an index that is not an integer.

For example, str[hello"] and str[2.1] as indexes. As these are not integers, a TypeError exception is raised. This means that when you’re accessing an iterable object like a string or float value, you must do it using an integer value .

Python supports slice notation for any sequential data type like lists, strings , tuples, bytes, bytearrays, and ranges. When working with strings and slice notation, it can happen that a TypeError: string indices must be integers is raised, pointing out that the indices must be integers, even if they obviously are.

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

4 participants