Problem with Woocommerce node, fails on Product > Get All

Hi everyone!

I’m trying to use Get All Products on the WooCommerce node and it returns “ERROR: Cannot read property ‘split’ of undefined”

The message it returns:

TypeError: Cannot read property 'split' of undefined
    at Object.woocommerceApiRequestAllItems (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/WooCommerce/GenericFunctions.js:47:44)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/WooCommerce/WooCommerce.node.js:253:40)
    at async /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:447:47

The simple workflow I’m using:

{
“nodes”: [
{
“parameters”: {
“operation”: “getAll”,
“returnAll”: true,
“options”: {}
},
“name”: “WooCommerce”,
“type”: “n8n-nodes-base.wooCommerce”,
“typeVersion”: 1,
“position”: [
420,
300
]
}
],
“connections”: {}
}

n8n version: 0.151.0
Database: PostgreSQL
Running on docker using the latest image on DockerHub

Thanks in advance!

Hi @Alejandro_Bonnin, welcome to the community :tada:

I’m very sorry to hear you’re running into this problem. I’ll need to set up a WordPress instance and install WooCommerce to give this a go first hand and will report back once done. Just to make sure: You do have products added to your WooCommerce database, right?

On a more general note, when posting code like the JSON representation one of your workflow, would you be able to wrap it in a preformatted block by using this button (or by manually adding three backticks ``` above and below your snippet)?

image

This will help greatly with copying it as it will prevent the forum from applying any formatting (though in this case it’s not a real problem as this is not a very complex workflow :wink:). I’ve also added these backticks to the question template to make it easier going forward.

Thank you so much!!

Yes, right now I have 10,300 products in the database, but it only allows me to import up to 100 products and if I try to import all at once it gives me the error.

Understood, thanks for the advice. I’ll do it the next time!

Thanks in advance!

1 Like

Thanks @Alejandro_Bonnin, it’s quite helpful to see this is happening only for a larger amount of products. Based on this info I assume the problem would then only occur if the Return All option is enabled (as in your example workflow) but otherwise the node is working fine?

Maybe there’s a problem with the pagination logic then. I’ll insert some more products in my store next to see what happens.

Okay, after adding a bit of additional logging I can see there definitely is definitely wrong with pagination when the Return All option is enabled.

image

The node would fetch page 1 and page 2 with 100 products each in an endless loop:

I could not reproduce the exact error you have described though @Alejandro_Bonnin. The split method from the error trace you have shared refers to the response headers received from WooCommerce, which for some reason does not seem to be available in your example. I wonder if this might just be a side effect of the problem I have noticed.

Let me fix the pagination problem first, maybe this also addresses your issue :slight_smile:

Found the issue and raised a pull request with a fix for the pagination problem:

We’ll let you know once it’s released.

2 Likes

Hi! Thanks a lot @MutedJam
Have a nice day!

Regards, Alex

1 Like

Hi Team,

Is there anyway to manually implement this fix or an ETA on when it might get included in the current release? Finding it hard to finish a few of my projects and trying to figure out if I am better off working around it if it might be some time until it’s fixed?

Cheers,
Chris

Hey @bitprecision,

I am surprised that one has not been picked ip already, I will look at it tomorrow if no one gets to it and see if we can get it included in the next couple of weeks.

2 Likes

Awesome! Thanks @Jon, love it!

Hey @bitprecision,

I have just done a review / test internally and it all looks good so I have passed it to the next step to get merged. We have been spending a lot of time working on reviewing the community node improvement PRs and missed this one.

In theory this one should be included next week / the week after so to be safe lets aim for before the end of the month just incase anything else pops up.

2 Likes

Fix got released with [email protected]

1 Like

Perfect guys, works like a dream! Thank you :slight_smile:

2 Likes

Hello @MutedJam Can you please check if we have the same issue for getAll customer and orders operation?
I am getting error “there was some problem running the flow”.

Hey @arfath77,

Welcome to the community :raised_hands:

There was an issue with customers and orders as well but during testing the change in 171.1 fixed it.

Before 171.1 you would get no error and it would keep trying to load the data, it sounds like you are getting a different issue.

Could you open a new thread and include the version of n8n you are running, the full error and a workflow that reproduces the issue.

Thank you @Jon ! I was using version 0.169.0, have now updated to the latest version and things are working fine.

1 Like

Hey @arfath77,

Fantastic that is good news :+1:

Hello @Jon, is there any limit on getAll?, for me it fetching only 1000 records from quickbooks for customers

Hey @arfath77,

There shouldn’t be but sometimes the methods used for pagination changes so we need to tweak them as they come up.

Can you pop open a new thread for quickbooks and we can take a proper look after the holiday :+1: