SpikeHD / AmazonMonitor

Amazon price checker, item monitor and stock monitor, all shoved into a Discord bot
GNU General Public License v3.0
221 stars 38 forks source link

[BUG] Error after stock alert attempts to send #97

Closed SquiresV1 closed 1 year ago

SquiresV1 commented 1 year ago

Describe the issue:

After around 2 minutes of it being ran it comes up with this error I think it has something to do with every time it the the minute_per_check cycle. I have checked the util.ts file at line 388 and it comes under the function sendInStockAlert so it is probably something to do with that. This happened during the query search so I think that's the problem.

Paste the contents of your config.json, excluding the token, here:

{
  "prefix":"!",
  "token":"",
  "minutes_per_check":2,
  "search_response_ms": 30000,
  "url_params":{},
  "guild_item_limit":50,
  "cache_limit": 10,
  "required_perms":["permission_1", "permission_2"],
  "tld":"co.uk",
  "auto_cart_link":true,
  "debug_enabled":false
}

Provide console output with debug mode enabled:


file:///C:/Users/mitch/Desktop/AmazonMonitor-master/common/util.ts:388
  if(auto_cart_link) link = `${obj.link.split('/dp/')[0]}/gp/aws/cart/add.html${parseParams(cfg.url_params)}&ASIN.1=${item.asin}&Quantity.1=1`
                                        ^
TypeError: Cannot read properties of undefined (reading 'split')
    at sendInStockAlert (file:///C:/Users/mitch/Desktop/AmazonMonitor-master/common/util.ts:388:41)
    at priceCheck (file:///C:/Users/mitch/Desktop/AmazonMonitor-master/common/util.ts:321:5)
    at file:///C:/Users/mitch/Desktop/AmazonMonitor-master/common/util.ts:275:13
    at Array.forEach (<anonymous>)
    at file:///C:/Users/mitch/Desktop/AmazonMonitor-master/common/util.ts:270:22
    at Generator.next (<anonymous>)
    at fulfilled (file:///C:/Users/mitch/Desktop/AmazonMonitor-master/common/util.ts:4:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
SpikeHD commented 1 year ago

Can you please paste your full watchlist.json here too?

SpikeHD commented 1 year ago

I tweaked the function in 250fc2a, try pulling/redownloading and see if the issue persists.

SquiresV1 commented 1 year ago

Works for me now, thank you.