error happening in thrift - javascript

I'm getting this error when running my script. Not sure why this is happening. Seems like there may be a bug in Evernote's Thrift
TypeError: Cannot read property 'length' of undefined
at Buffer.write (buffer.js:733:13)
at Object.BinaryParser.fromString (/Users/sam/Documents/evernote/node_modules/evernote/lib/thrift/protocol/binaryProtocol.js:502:12)
at BinaryProtocol.writeString (/Users/sam/Documents/evernote/node_modules/evernote/lib/thrift/protocol/binaryProtocol.js:148:30)
at BinaryProtocol.writeType (/Users/sam/Documents/evernote/node_modules/evernote/lib/thrift/protocol/binaryProtocol.js:168:25)
at new Thrift.List.write (/Users/sam/Documents/evernote/node_modules/evernote/lib/thrift/thrift.js:275:20)
at new Thrift.Struct.write (/Users/sam/Documents/evernote/node_modules/evernote/lib/thrift/thrift.js:530:17)
at Thrift.Struct.write (/Users/sam/Documents/evernote/node_modules/evernote/lib/thrift/thrift.js:530:17)
at Thrift.Method.sendRequest (/Users/sam/Documents/evernote/node_modules/evernote/lib/thrift/thrift.js:162:15)
at NoteStoreClient.updateNote (/Users/sam/Documents/evernote/node_modules/evernote/lib/thrift/gen-js2/NoteStore.js:1700:8)
at /Users/sam/Documents/evernote/node_modules/evernote/lib/stores.js:106:14

NoteStore#updateNote takes a Note object as an argument. You should be able to instantiate it by new Evernote.Note(). Note that it seems you don't have to set title if you are not going to update it.

Related

Circular JSON stringify error without relevant stack trace on Nest.js

The following error is killing my application in production:
/usr/src/app/node_modules/#nestjs/common/services/console-logger.service.js:137
? `${this.colorize('Object:', logLevel)}\n${JSON.stringify(message, (key, value) => typeof value === 'bigint' ? value.toString() : value, 2)}\n`
^
TypeError: Converting circular structure to JSON
--> starting at object with constructor 'ClientRequest'
| property 'socket' -> object with constructor 'Socket'
--- property '_httpMessage' closes the circle
at JSON.stringify (<anonymous>)
at ConsoleLogger.stringifyMessage (/usr/src/app/node_modules/#nestjs/common/services/console-logger.service.js:137:62)
at ConsoleLogger.formatMessage (/usr/src/app/node_modules/#nestjs/common/services/console-logger.service.js:130:29)
at /usr/src/app/node_modules/#nestjs/common/services/console-logger.service.js:122:43
at Array.forEach (<anonymous>)
at ConsoleLogger.printMessages (/usr/src/app/node_modules/#nestjs/common/services/console-logger.service.js:117:18)
at ConsoleLogger.error (/usr/src/app/node_modules/#nestjs/common/services/console-logger.service.js:44:14)
at Logger.error (/usr/src/app/node_modules/#nestjs/common/services/logger.service.js:34:75)
at Logger.descriptor.value (/usr/src/app/node_modules/#nestjs/common/services/logger.service.js:163:27)
at ExceptionsHandler.handleUnknownError (/usr/src/app/node_modules/#nestjs/core/exceptions/base-exception-filter.js:54:43)
I can't reproduce it on development and I don't know what is causing this error. Is there any way to make the stack trace include the source of this error?
I already ran it with DEBUG=*, but it doesn't give me a conclusive answer.
I think the error is happening close to these lines (based on logs), but I can't tell for sure:
this.logger.error(error.toString())
throw new InternalServerErrorException(error.toString())
It doesn't seems to be related, because error.toString() evaluates to [object Object] (useless, but not wrong).
Based on the properties, it looks like probably an AxiosError or some other HTTP client error was thrown directly without being converted into an HttpException that Nest would know how to handle and Nest then tried to log out the error. I would check your uses of HttpService (if you use it) or any other HTTP clients you use. If you still can't find anything, I'd suggest using a different logger than Nest's that can handle circular JSON. My preference is ogma, but I'm also the author of it. pino is another good choice

discord.js Stop that the Bot is turing off after an Error

Hey everytime i get an Error the Bot turns off... And i dont want that. Can i somewhere turn it off or something like this?
I tried something like
client.on("error", () => { client.login(config.token) })
But thats not working. Some of the Errors are:
TypeError: Cannot read property 'id' of null
D:\Discord Bot\Space Network\spacenetwork\node_modules\discord.js\src\client\actions\ChannelCreate.js:9
const existing = client.channels.cache.has(data.id);
at ChannelCreateAction.handle (D:\Discord Bot\Space Network\spacenetwork\node_modules\discord.js\src\client\actions\ChannelCreate.js:9:53)
at User.createDM (D:\Discord Bot\Space Network\spacenetwork\node_modules\discord.js\src\structures\User.js:257:46)
at processTicksAndRejections (node:internal/process/task_queues:94:5)
at async D:\Discord Bot\Space Network\spacenetwork\index.js:663:22
TypeError: Cannot read property 'setActivity' of null
That is because your code has errors in it, the best practice is to fix the error instead of bypassing it TypeError: Cannot read property 'id' of null this means, whatever that comes before 'id' property is null
const existing = client.channels.cache.has(data.id); the error is at this line, try logging data.id, according to the error 'data' is null, fix that and it should solve the problem
The point to note is, reading the errors, finding the source of the error and fixing the error :)
You can use nodemon. I think they make it so that whenever you make changes to your code and save it, it automatically runs, and if it crashes, it restarts it automatically. However, I’d be careful with this, considering if have the error in the ready message, the bot will connect over and over again, and I think discord will automatically shut it down.
npm install nodemon -g

Ember FastBoot Cannot read property 'userAgent' of undefined

I'm trying to use Ember FastBoot for my application but when I run:
ember fastboot --serve-assets this error is thrown:
Cannot read property 'userAgent' of undefined
TypeError: Cannot read property 'userAgent' of undefined
at Object.125.global/document (<anonymous>:121923:53)
at s (<anonymous>:104896:621)
at <anonymous>:104896:672
at Object.106../big-play-button.js (<anonymous>:113849:23)
at s (<anonymous>:104896:621)
at <anonymous>:104896:672
at Object.139.../../src/js/utils/merge-options.js (<anonymous>:123824:15)
at s (<anonymous>:104896:621)
at e (<anonymous>:104896:792)
at <anonymous>:104896:810
any help?
The repo you posted contains a number of references to document and window. You will have to use the ember provided facility for detecting the current environment details and implement conditional logic based on whether your pages are being rendered in the browser or not. You can use environment.hasDOM to perform that check.

XPathResult is undefined

I have the error "Uncaught TypeError: Cannot read property 'FIRST_ORDERED_NODE_TYPE' of undefined" in some cases (not always) when run next code:
var type = XPathResult.FIRST_ORDERED_NODE_TYPE;
At the same time next code works fine for the same cases:
if (XPathResult)
var type = XPathResult.FIRST_ORDERED_NODE_TYPE;
It seems error is raised by interpretator, but not in runtime. Probably the problem is related with activation of window object.
I have this workaround with check if object exists but i want to figure out what is the real problem. Any ideas?
UPD: The problem is reproducableonly in Chrome

Can't choose an option on a configurable product, when i merge javascript

I have a bit of a problem. I have huge amount of JavaScript on my site, and when i am trying to merge it, i suddenly can't choose an option.
The console in Google Chrome shows this:
Uncaught TypeError: undefined is not a function
The code is simply to long
Uncaught TypeError: Cannot read property 'OptionsPrice' of undefined
<script>
var optionsPrice = new Product.OptionsPrice({"productId":"224","priceFormat":{"pattern":"%s\u00a0DKK ","precision":2,"requiredPrecision":2,"decimalSymbol":",","groupSymbol":".","groupLength":3,"integerRequired":1},"includeTax":"true","showIncludeTax":true,"showBothPrices":false,"productPrice":29,"productOldPrice":29,"priceInclTax":29,"priceExclTax":29,"skipCalculate":1,"defaultTax":25,"currentTax":25,"idSuffix":"_clone","oldPlusDisposition":0,"plusDisposition":0,"plusDispositionTax":0,"oldMinusDisposition":0,"minusDisposition":0,"tierPrices":[],"tierPricesInclTax":[]});
</script>
Uncaught TypeError: Cannot read property 'Config' of undefined
<script>
var spConfig = new Product.Config({"attributes":{"145":{"id":"145","code":"size","label":"St\u00f8rrelse","options":[{"id":"32","label":"10ml","price":"0","oldPrice":"0","products":["225","226","227","228"]},{"id":"31","label":"30ml","price":"30","oldPrice":"30","products":["229","230","231","232"]}]},"146":{"id":"146","code":"styrke","label":"Styrke","options":[{"id":"36","label":"0mg","price":"0","oldPrice":"0","products":["225","229"]},{"id":"35","label":"6mg","price":"0","oldPrice":"0","products":["226","230"]},{"id":"34","label":"12mg","price":"0","oldPrice":"0","products":["227","231"]},{"id":"33","label":"18mg","price":"0","oldPrice":"0","products":["228","232"]}]}},"template":"#{price}\u00a0DKK ","basePrice":"29","oldPrice":"29","productId":"224","chooseText":"--V\u00e6lg venligst--","taxConfig":{"includeTax":true,"showIncludeTax":true,"showBothPrices":false,"defaultTax":25,"currentTax":25,"inclTaxTitle":"Inkl. moms"}});
</script>
Uncaught Reference Error: Calendar is not defined
Calendar._DN = ["s\u00f8ndag","mandag","tirsdag","onsdag","torsdag","fredag","l\u00f8rdag"]; // full day names
I hope there is someway that you can help me.
I am on a Magento platform, with a custom template.
Thanks
This sounds like a syntax error in one of the JS files. Either in the one where Product is defined or where you get your first error.
Sometimes you miss a comma and your entire object is not defined. I would look for that first.
The easiest way is to use JSLint.
where is "Product" defined?
you should first have Product in your page! or is it defined in a closure function?

Categories