VAST Error: on VASTClient.buildVastTree - javascript

I use VideoJS + VAST/VPAID plugin. Getting this error on any VAST/VPAID XML when I try to play Ad:
VIDEOJS: ERROR: (CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED) The video could
not be loaded, either because the server or network failed or because
the format is not supported
I use this and this as sample XML, and some of my own made.
Console output:
AD ERROR: VAST Error: on VASTClient.buildVastTree, error parsing xml z {message: "VAST Error: on VASTClient.buildVastTree, error parsing xml", code: 100}code: 100message: "VAST Error: on VASTClient.buildVastTree, error parsing xml"stack: (...)__proto__: Error
at http://example.com/videojs/vpaid/videojs-vast-vpaid.min.js:2:29160
at http://example.com/videojs/vpaid/videojs-vast-vpaid.min.js:3:6281name: "VAST Error"stack: (...)get stack: ()arguments: nullcaller: nulllength: 0name: ""prototype: aK__proto__: ()<function scope>No Scopesset stack: ()arguments: nullcaller: nulllength: 1name: ""prototype: aN__proto__: ()<function scope>__proto__: DefineError.aTconstructor: Error()message: ""name: "Error"toString: toString()__proto__: Object__defineGetter__: __defineGetter__()__defineSetter__: __defineSetter__()__lookupGetter__: __lookupGetter__()__lookupSetter__: __lookupSetter__()constructor: Object()hasOwnProperty: hasOwnProperty()isPrototypeOf: isPrototypeOf()propertyIsEnumerable: propertyIsEnumerable()toLocaleString: toLocaleString()toString: toString()valueOf: valueOf()get __proto__: get __proto__()set __proto__: set __proto__() undefined
Any ideas how to fix this?

Ok, never mind I've just fixed this by debeautifying all JS library files, possibly it's some kind of parsing errors.

Related

Getting the right stack trace out of jest

I am currently debugging some tests written with jest over typescript and I'm having a bit of a headache.
If a test, or tested class, runs Postgres SQL and there is an error in the query, I get the wrong stack trace, for example, this:
error: invalid input syntax for type integer: ""0""
at Parser.parseErrorMessage (/Users/sklivvz/src/xxx/node_modules/pg-protocol/src/parser.ts:369:69)
at Parser.handlePacket (/Users/sklivvz/src/xxx/node_modules/pg-protocol/src/parser.ts:188:21)
at Parser.parse (/Users/sklivvz/src/xxx/node_modules/pg-protocol/src/parser.ts:103:30)
at Socket.<anonymous> (/Users/sklivvz/src/xxx/node_modules/pg-protocol/src/index.ts:7:48)
at Socket.emit (node:events:365:28)
at addChunk (node:internal/streams/readable:314:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Socket.Readable.push (node:internal/streams/readable:228:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
The "error" line is very useful, however, the stack trace only tells me that the error was thrown by the pg-protocol driver. I would like to know which line within my code generated the error.
I am exactly 82.7% sure that this is due to PG's query being async.
It is incredibly time-consuming having to step debug or (gasp) console.log my way to each error when it would only be a matter of showing the correct call stack in order to make it better.
Has anyone found a way of making this developer-friendly?
Check if this is related to brianc/node-postgres issue 2484
is (there) a preferred package, extension, or method for providing more detail when you get a syntax error back from the parser?
(for instance, one that listed line number, column of the error)
for instance, right now:
error: syntax error at or near "as"
at Parser.parseErrorMessage (/home/collspec/projects/staff-portal/sprint-server/node_modules/pg-protocol/dist/parser.js:278:15)
desired behavior:
error: syntax error at or near "as", line 5, column 7
at Parser.parseErrorMessage (/home/collspec/projects/staff-portal/sprint-server/node_modules/pg-protocol/dist/parser.js:278:15)
Possible workaround from that issue:
There are a bunch of additional fields on Error objects populated by the driver.
If you log the error object you can see them. They correspond to the error fields returned by the server:
For example with the command:
SELECT foo
FROM bar
You can get an error like this:
{
length: 102,
severity: 'ERROR',
code: '42P01',
detail: undefined,
hint: undefined,
position: '17',
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'parse_relation.c',
line: '1180',
routine: 'parserOpenTable'
}
The one you want is position. It gives you the character offset in the SQL of the error.
In this example the position value of "17" refers to the start of the bar token in the SQL.
It's not always populated though as it depends on what caused the error (generally just parse errors).
I ran into a similar issue with aws-sdk for DynamoDb. This is a stacktrace I usually get from aws-sdk.
ResourceNotFoundException: Requested resource not found
at Request.extractError (D:\workspaces\typescript-starters\console-app\node_modules\aws-sdk\lib\protocol\json.js:52:27)
at Request.callListeners (D:\workspaces\typescript-starters\console-app\node_modules\aws-sdk\lib\sequential_executor.js:106:20)
at Request.emit (D:\workspaces\typescript-starters\console-app\node_modules\aws-sdk\lib\sequential_executor.js:78:10)
at Request.emit (D:\workspaces\typescript-starters\console-app\node_modules\aws-sdk\lib\request.js:688:14)
at Request.transition (D:\workspaces\typescript-starters\console-app\node_modules\aws-sdk\lib\request.js:22:10)
at AcceptorStateMachine.runTo (D:\workspaces\typescript-starters\console-app\node_modules\aws-sdk\lib\state_machine.js:14:12)
at D:\workspaces\typescript-starters\console-app\node_modules\aws-sdk\lib\state_machine.js:26:10
at Request.<anonymous> (D:\workspaces\typescript-starters\console-app\node_modules\aws-sdk\lib\request.js:38:9)
at Request.<anonymous> (D:\workspaces\typescript-starters\console-app\node_modules\aws-sdk\lib\request.js:690:12)
at Request.callListeners (D:\workspaces\typescript-starters\console-app\node_modules\aws-sdk\lib\sequential_executor.js:116:18)
My workaround is simply to catch async errors, and overwrite their stack traces. On the other hand, you may append Postgres stacktrace, or error message to your own errors.
async function getPersonFromDb (personId: string): Promise<DocumentClient.AttributeMap | undefined> {
const result = await documentClient.get({ // Similar to postgres.query()
TableName: 'wrong-name',
Key: { pk: personId, sk: personId }
}).promise().catch(error => {
Error.captureStackTrace(error)
throw error
})
return result.Item
}
test('Get a person from DynamoDB', async () => {
const person = await getPersonFromDb('hello')
expect(person).not.toBeUndefined()
})
// ========= new stacktrace ========
Error: Requested resource not found
at D:\workspaces\typescript-starters\console-app\test\abc.test.ts:12:13
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at getPersonFromDb (D:\workspaces\typescript-starters\console-app\test\abc.test.ts:8:20)
at Object.<anonymous> (D:\workspaces\typescript-starters\console-app\test\abc.test.ts:18:20) // my code, and where my error is thrown

Can't find variable: __TEST__

I'm new at Nativescript. Whenever I try to compile a project on my iPhone; It gives me this exception.
My phone on 14.0 and Nativescript on 7.0.11
Log is there:
2020-12-01 00:12:26.786 nsplaydev[49332:2731673] JavaScript error:
file:///app/tns_modules/react-nativescript/dist/nativescript-vue-next/runtime/registry.js:61:14: JS ERROR
ReferenceError: Can't find variable: _TEST_
2020-12-01 00:12:26.788 nsplaydev[49332:2731673] PlayLiveSync: Uncaught Exception
NativeScript encountered a fatal error: ReferenceError: Can't find variable: _TEST_
at
anonymous(file:///app/tns_modules/react-nativescript/dist/nativescript-vue-next/runtime/registry.js:61:14)

Angular 8 - Getting Runtime compiler not loaded error

I need to dynamically create lazy loaded routes. When I use import syntax, e.g. loadChildren: () => import(`./pages/${module.moduleName}/${module.moduleName}.module`).then(m => m[childModuleName]), it works on JIT but when running on AOT, it throws this error:
ERROR Error: Uncaught (in promise): Error: Runtime compiler is not loaded as per https://github.com/angular/angular-cli/issues/10582 the solution would be to use the old string syntax:
```` loadChildren: ./pages/${module.moduleName/${module.moduleName}.module#${childModuleName},
I get this error:
``` ERROR Error: Uncaught (in promise): Error: Cannot find module './pages/client-migration/client-migration.module.ngfactory' ```
import the module name into your module.ts.

Setting up react-native — Unhelpful error messages

I'm at a bit of a loss in setting up my React-Native project.
The simulator renders that start/loading page, but then fails to render index.ios.js
I'm recieving the following errors in the Xcode console and having no luck in troubleshooting what the problem might:
2015-10-05 14:02:40.995 [info][tid:com.facebook.React.JavaScript] 'Failed to print error: ', 'Requiring module "ExceptionsManager" which threw an exception'
2015-10-05 14:02:40.998 [info][tid:com.facebook.React.JavaScript] 'Failed to print error: ', 'undefined is not an object (evaluating \'require(\'ExceptionsManager\').handleException\')'
2015-10-05 14:02:41.036 [info][tid:com.facebook.React.JavaScript] 'Failed to print error: ', 'Requiring module "ExceptionsManager" which threw an exception'
2015-10-05 14:02:41.038 [info][tid:com.facebook.React.JavaScript] 'Failed to print error: ', 'undefined is not an object (evaluating \'require(\'ExceptionsManager\').handleException\')'
2015-10-05 14:02:41.067 [info][tid:com.facebook.React.JavaScript] 'Failed to print error: ', 'Requiring module "ExceptionsManager" which threw an exception'
2015-10-05 14:02:41.075 [info][tid:com.facebook.React.JavaScript] 'Failed to print error: ', 'undefined is not an object (evaluating \'require(\'ExceptionsManager\').handleException\')'
In chrome dev tools debugger-ui I get the following errors:
Failed to print error: Requiring module "Promise" which threw an exception —InitializeJavaScriptAppEngine.js:43
Failed to print error: Requiring module "ExceptionsManager" which threw an exception — InitializeJavaScriptAppEngine.js:43
Failed to print error: Cannot read property 'handleException' of undefined
If these errors are familiar to anyone any help would be greatly appreciated.
Thanks

Node.js Bluebird Promise complains of "Converting circular structure to JSON"

For making a outgoing api call, I am using restler wrapped in a bluebird promise object. However, I am getting a Possibly unhandled TypeError: Converting circular structure to JSON at node_modules/bluebird/js/main/promise.js.
This happens even without JSON.stringify. It is happening at the level of promise.js.
What can I do about this?
rest.postJson(uri, body).then(
function(response) {
console.log(response.access.token.id);
console.log(response.statusCode);
res.send(response.access.token.id);
}, function(error) {
console.log(error.statusCode);
res.send(JSON.stringify(error));
//res.send(error);
});
Possibly unhandled TypeError: Converting circular structure to JSON
at Object.stringify (native)
at ServerResponse.res.json (/home/one/try/cloudimageshare-monitoring/project/node_modules/express/lib/response.js:205:19)
at ServerResponse.res.send (/home/one/try/cloudimageshare-monitoring/project/node_modules/express/lib/response.js:121:21)
at /home/one/try/cloudimageshare-monitoring/project/app/scripts/proxy/proxies_express_module.js:39:29
at tryCatch1 (/home/one/try/cloudimageshare-monitoring/project/node_modules/bluebird/js/main/util.js:43:21)
at Promise$_callHandler [as _callHandler] (/home/one/try/cloudimageshare-monitoring/project/node_modules/bluebird/js/main/promise.js:627:13)
at Promise$_settlePromiseFromHandler [as _settlePromiseFromHandler] (/home/one/try/cloudimageshare-monitoring/project/node_modules/bluebird/js/main/promise.js:641:18)
at Promise$_settlePromiseAt [as _settlePromiseAt] (/home/one/try/cloudimageshare-monitoring/project/node_modules/bluebird/js/main/promise.js:804:14)
at Promise$_settlePromises [as _settlePromises] (/home/one/try/cloudimageshare-monitoring/project/node_modules/bluebird/js/main/promise.js:938:14)
at Promise$_rejectPromises [as _rejectPromises] (/home/one/try/cloudimageshare-monitoring/project/node_modules/bluebird/js/main/promise.js:931:10)
UPDATE: Here are the keys of the error object if it helps any:
[ '_readableState',
'readable',
'domain',
'_events',
'_maxListeners',
'socket',
'connection',
'httpVersion',
'complete',
'headers',
'trailers',
'_pendings',
'_pendingIndex',
'url',
'method',
'statusCode',
'client',
'_consuming',
'_dumped',
'httpVersionMajor',
'httpVersionMinor',
'upgrade',
'req',
'pipe',
'addListener',
'on',
'pause',
'resume',
'read',
'rawEncoded',
'raw' ]
No. When you don't pass a string to express' res.send but an object (like error), it will call JSON.stringify internally. This will for sure not happen in promise.js (however, Bluebird does weird things to the stacktrace). Try
res.send(error.message);

Categories