hope you all are healthy and safe,
so currently I am trying to use video-stitch NPM package for merge couple of videos together so here is my approach
const videoStitch = require("video-stitch");
const videoConcat = videoStitch.concat;
try {
// merge
videoConcat({
silent: false,
})
.clips([
{
fileName:
"E:\\WS\\Projects\\vitok\\videos\\source\\6999919482068077826.mp4",
},
{
fileName:
"E:\\WS\\Projects\\vitok\\videos\\source\\7010852541999205637.mp4",
},
])
.output("test.mp4") //optional absolute file name for output file
.concat()
.then((outputFileName) => {
console.log(`ouput: ${outputFileName}`);
});
} catch (error) {
console.log("error", error);
}
as you can see this is just a test so I am using absolute hard coded paths ..etc this works fine and incredibly fast. until I tried to use this useful function into a Node.js API I just copied same code to a function and hook it into one of my API end points and also made sure all paths are valid but I got this error log
ffmpeg version N-103968-g9fbe54e4b2-20211003 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10-win32 (GCC) 20210408
configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libvmaf --enable-vulkan --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-avisynth --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libglslang --enable-libgme --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --disable-vaapi --enable-libvidstab --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20211003
libavutil 57. 7.100 / 57. 7.100
libavcodec 59. 10.100 / 59. 10.100
libavformat 59. 5.100 / 59. 5.100
libavdevice 59. 0.101 / 59. 0.101
libavfilter 8. 11.100 / 8. 11.100
libswscale 6. 1.100 / 6. 1.100
libswresample 4. 0.100 / 4. 0.100
libpostproc 56. 0.100 / 56. 0.100
[mov,mp4,m4a,3gp,3g2,mj2 # 0000025e87d6d880] Format mov,mp4,m4a,3gp,3g2,mj2 detected only with low score of 1, misdetection possible!
[mov,mp4,m4a,3gp,3g2,mj2 # 0000025e87d6d880] moov atom not found
[concat # 0000025e87d6c480] Impossible to open 'E:\\WS\\Projects\\vitok\\videos\\source\\6999919482068077826.mp4'
C:\Users\Abdel\AppData\Local\Temp\tmp-10992iQXU7FqWElTK.txt: Invalid data found when processing input
(node:10992) UnhandledPromiseRejectionWarning: undefined
(Use `node --trace-warnings ...` to show where the warning was created)
(node:10992) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:10992) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I am not sure what is the problem, but for some reason its not running when I hook it to an API endpoint and works otherwise, I also tried to copy same function and run it when the API starts and it also worked, but when I try to use it in a API end point function it just crashes giving me the error above.
Am I doing anything wrong here? thanks in advance
Related
i'm only trying to launch the exemple of the app kit OrbitDB which is :
import OrbitDB from "orbit-db";
import IPFS from "ipfs";
async function main () {
// Create IPFS instance
const ipfsOptions = { repo : './ipfs', }
const ipfs = await IPFS.create(ipfsOptions)
// Create OrbitDB instance
const orbitdb = await OrbitDB.createInstance(ipfs)
// Create database instance
const db = await orbitdb.keyvalue('ipfs_db')
}
main()
you can find it here : https://github.com/dappkit/aviondb#using-nodejs
but the problem is when i launch it, i got these errors :
Swarm listening on /ip4/127.0.0.1/tcp/4002/p2p/12D3KooWM7D9NdMhtxyiWiKH4XVpuZW5oDu9MbWxFmEzLsG9UynM
Swarm listening on /ip4/192.168.1.53/tcp/4002/p2p/12D3KooWM7D9NdMhtxyiWiKH4XVpuZW5oDu9MbWxFmEzLsG9UynM
Swarm listening on /ip4/127.0.0.1/tcp/4003/ws/p2p/12D3KooWM7D9NdMhtxyiWiKH4XVpuZW5oDu9MbWxFmEzLsG9UynM
IPFSAccessController.save ERROR: Error: Deprecated, use .toString()
at CID.get toBaseEncodedString [as toBaseEncodedString] (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/multiformats/cjs/src/cid.js:94:11)
at Object.writeCbor [as write] (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/aviondb/node_modules/orbit-db-access-controllers/node_modules/orbit-db-io/index.js:62:14)
at async IPFSAccessController.save (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/aviondb/node_modules/orbit-db-access-controllers/src/ipfs-access-controller.js:46:13)
at async Function.create (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/aviondb/node_modules/orbit-db-access-controllers/src/access-controllers.js:68:20)
at async OrbitDB._determineAddress (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/aviondb/node_modules/orbit-db/src/OrbitDB.js:331:37)
(node:8397) UnhandledPromiseRejectionWarning: Error: `undefined` is not supported by the IPLD Data Model and cannot be encoded
at undefinedEncoder (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/#ipld/dag-cbor/cjs/index.js:47:9)
at objectToTokens (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/cborg/cjs/lib/encode.js:175:20)
at Object (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/cborg/cjs/lib/encode.js:149:9)
at objectToTokens (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/cborg/cjs/lib/encode.js:184:10)
at Object (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/cborg/cjs/lib/encode.js:149:9)
at objectToTokens (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/cborg/cjs/lib/encode.js:184:10)
at encodeCustom (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/cborg/cjs/lib/encode.js:214:18)
at Object.encode (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/cborg/cjs/lib/encode.js:236:10)
at Object.encode (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/#ipld/dag-cbor/cjs/index.js:85:41)
at put (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/ipfs-core/src/components/dag/put.js:35:25)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:8397) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:8397) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
i seriously don't know what to do, i tried to clear the cache, to delete node_modules and package-lock.json, and do a npm install, but nothing changed, i got the same error, do you have any idea to fix this ?
This error clearly points to an incompatibility between IPFS and OrbitDB.
The latest version of js-ipfs that OrbitDB v0.26.1 supports is 0.55.4.
You should change the ipfs (or ipfs-core) version in your package.json to ^0.55.4.
Note: The upcoming OrbitDB v0.27, will support the latest IPFS version.
I am trying to compile Zig functions to a freestanding WebAssembly module using the wasm32-freestanding target. The official documentation has a section explaining how to do this, but with a recent version of Zig (0.8.0) I get errors when trying to instantiate the resulting module with JavaScript.
// file: main.zig
export fn add(a: i32, b: i32) i32 {
return a +% b;
}
// file: test.js
WebAssembly.instantiate((function() {
const source = require("fs").readFileSync("main.o");
return new Uint8Array(source);
})(), { env: {} }).then(wasm => {
const add = wasm.instance.exports.add;
console.log(add(1, 2));
});
$ zig version
0.8.0
$ node --version
14.17.3
$ zig build-obj main.zig -target wasm32-freestanding -dynamic -OReleaseFast
$ wc -c main.o # the generated code has extension `.o` instead of `.wasm`
135
$ node test.js
(node:2449) UnhandledPromiseRejectionWarning: LinkError: WebAssembly.instantiate(): Import #0 module="env" function="__linear_memory" error: memory import must be a WebAssembly.Memory object
(Use `node --trace-warnings ...` to show where the warning was created)
(node:2449) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:2449) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Inspecting the generated wasm module shows that it attempts to import a value called __linear_memory from the scope env. Naturally this fails as I am not providing such an import. However, the example project zig-wasm-test includes a WASM module (compiled with an old version of Zig) which does not include these imports.
What am I doing wrong here? Should I just be providing a __linear_memory export to the module even though it isn't used?
You should try using build-lib instead of build-obj.
I am taking a training course, on Udemy, and it had backend code already written, as the course is purely about frontend development. It uses a very simple MongoDB database that I created. I determined that MongoDB version 4.0.10 is installed on my computer, in case that's relevant. When trying to perform a query for matching records, I get the following error:
UnhandledPromiseRejectionWarning: MongoError: FieldPath field names may not start with '$'.
at MessageStream.messageHandler (I:\DEV\Training\React For the Rest of Us\backend-api\node_modules\mongodb\lib\cmap\connection.js:268:20)
at MessageStream.emit (events.js:315:20)
at processIncomingData (I:\DEV\Training\React For the Rest of Us\backend-api\node_modules\mongodb\lib\cmap\message_stream.js:144:12)
at MessageStream._write (I:\DEV\Training\React For the Rest of Us\backend-api\node_modules\mongodb\lib\cmap\message_stream.js:42:5)
at writeOrBuffer (internal/streams/writable.js:358:12)
at MessageStream.Writable.write (internal/streams/writable.js:303:10)
at TLSSocket.ondata (internal/streams/readable.js:719:22)
at TLSSocket.emit (events.js:315:20)
at addChunk (internal/streams/readable.js:309:12)
at readableAddChunk (internal/streams/readable.js:284:9)
(node:51960) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To
terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
After looking into the backend code, I found the following code that is being used to perform the query/search, and I did notice that there are $ symbols in various places.
Post.search = function(searchTerm) {
return new Promise(async (resolve, reject) => {
if (typeof(searchTerm) == "string") {
let posts = await Post.reusablePostQuery([
{$match: {$text: {$search: searchTerm}}},
{$sort: {score: {$meta: "textScore"}}}
])
resolve(posts)
} else {
reject()
}
})
}
What exactly is wrong and how do I fix it?
Identical error here. Searching from react using axios in the main app-very simple(supposed to be). It's indicative that in my case when trying to search- "open search mode" from react", mongodb server crashes with mentioned error:
f:\PrgsReact\SimplePost\backend-api\node_modules\mongodb\lib\cmap\connection.js:268
callback(new MongoError(document));
MongoError: FieldPath field names may not start with '$'.
etc..
I'm tried to change npm ver of mongodb and axios inter alia. Thanks.
Using the jest-preset-angular to perform the unit test, but got an warning as UnhandledPromiseRejectionWarning: TypeError: Converting circular structure to JSON not sure what causing the error, due to this the application is stuck and not running the other unit test.
PASS src/app/pages/result/result-filter/result-filter.component.spec.ts (6.251 s)
PASS src/app/pages/result/search-navigation/search-navigation.component.spec.ts
PASS src/app/pages/result/filter-modal/filter-modal.component.spec.ts (5.699 s)
PASS src/app/app.component.spec.ts
PASS src/app/pages/test-type/test-type.component.spec.ts (12.857 s)
(node:3280) UnhandledPromiseRejectionWarning: TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Object'
| property 'element' -> object with constructor 'Object'
| property 'componentProvider' -> object with constructor 'Object'
--- property 'parent' closes the circle
at stringify (<anonymous>)
at writeChannelMessage (internal/child_process/serialization.js:117:20)
at process.target._send (internal/child_process.js:808:17)
at process.target.send (internal/child_process.js:706:19)
at reportSuccess (/Users/macbook/Projects/Playtime Projects/IDP/Idp.Bx.Ui/idp/node_modules/jest-worker/build/workers/processChild.js:67:11)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:3280) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:3280) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:3281) UnhandledPromiseRejectionWarning: TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Object'
| property 'element' -> object with constructor 'Object'
| property 'componentProvider' -> object with constructor 'Object'
--- property 'parent' closes the circle
at stringify (<anonymous>)
at writeChannelMessage (internal/child_process/serialization.js:117:20)
at process.target._send (internal/child_process.js:808:17)
at process.target.send (internal/child_process.js:706:19)
at reportSuccess (/Users/macbook/Projects/Playtime Projects/IDP/Idp.Bx.Ui/idp/node_modules/jest-worker/build/workers/processChild.js:67:11)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:3281) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:3281) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:3279) UnhandledPromiseRejectionWarning: TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Object'
| property 'element' -> object with constructor 'Object'
| property 'componentProvider' -> object with constructor 'Object'
--- property 'parent' closes the circle
at stringify (<anonymous>)
at writeChannelMessage (internal/child_process/serialization.js:117:20)
at process.target._send (internal/child_process.js:808:17)
at process.target.send (internal/child_process.js:706:19)
at reportSuccess (/Users/macbook/Projects/Playtime Projects/IDP/Idp.Bx.Ui/idp/node_modules/jest-worker/build/workers/processChild.js:67:11)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:3279) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:3279) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
RUNS src/app/pages/location/location.component.spec.ts
RUNS src/app/pages/signup/signup.component.spec.ts
RUNS src/app/pages/login/login.component.spec.ts
Test Suites: 10 passed, 10 of 20 total
Tests: 16 passed, 16 total
Snapshots: 1 obsolete, 5 passed, 5 total
Time: 2180 s
I am not sure how to run the node --trace-warnings. Looks like it a serialization issue, even it is just a warning but not sure where is the issue. Is there any better way to find the exception
Run jest with --detectOpenHandles. This will show you what is actually wrong with your test spec. For me, there were missing Angular Material imports and service mocks. You may be prompted to add the BrowserAnimationsModule, as Nambi alluded to in his answer
package.json:
"test": "jest --detectOpenHandles"
This message usually appears, if there is an error, that does not resolve into a standard exception.
As mentioned by #JamesBarret using jests detect open handle feature will provide you with a nice error message, telling you what the real problem behind this message is.
The handle --detectOpenHandles mentioned in the other message is deprecated though and was replaced with --detect-open-handles.
You can just use: (on your cli)
jest --detect-open-handles
Or in a package.json file:
"test": "jest --detect-open-handles"
Or as it was in my case an angular test:
ng test --detect-open-handles
Adding my answer to help someone if missed.
In my case i have missed to import
import { BrowserAnimationsModule } from '#angular/platform-browser/animations';
Able to find the issue only when running one of the test case in isolation.
The issue was with the async operation, so writing the test case with below, solve the issue for me
describe('DateSelectionComponent', () => {
let component: DateSelectionComponent;
let fixture: ComponentFixture<DateSelectionComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [DateSelectionComponent, SafePipe],
imports: [
SharedModule,
NgReduxTestingModule,
RouterTestingModule.withRoutes([])
],
providers: [
{
provide: PageAPIActions, useValue: { setPageState() { } }
}
]
}).compileComponents();
fixture = TestBed.createComponent(DateSelectionComponent);
component = fixture.componentInstance;
// Don't use Object.defineProperty when assigning value to class properties
component.page$ = of('value');
component.page = { destination: 'value' };
component.startDate = new NgbDate(2019, 2, 27);
component.minDate = new NgbDate(2019, 2, 27);
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
it('Should Match Snapshot', () => {
expect(fixture.debugElement.nativeElement).toMatchSnapshot()
});
});
In my situation, the cryptic error was triggered by not importing HttpClientModule into the test file. More details here.
I had this same issue when running jest with --watch. Removing --watch stopped the error.
Looks like the error is due to some async operation being done. Try wrapping your unit test inside a waitForAsync function.
I am trying to do a mouse click base on position. However, I can't seem to make action work an always get the following message. I reproduced the problem by trying to double click on google.com main search bar.
For help, see: https://nodejs.org/en/docs/inspector
(node:38864) UnhandledPromiseRejectionWarning: UnknownCommandError: Unrecognized command: actions
warning.js:18
at buildRequest (c:\GitRepo\MMT4\src\javascript\Web.Tests\node_modules\selenium-webdriver\lib\http.js:375:9)
at Executor.execute (c:\GitRepo\MMT4\src\javascript\Web.Tests\node_modules\selenium-webdriver\lib\http.js:455:19)
at Driver.execute (c:\GitRepo\MMT4\src\javascript\Web.Tests\node_modules\selenium-webdriver\lib\webdriver.js:696:38)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:38864) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
warning.js:18
(node:38864) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
imported the packages with npm
"devDependencies": {
"#types/node": "^10.12.0"
},
"dependencies": {
"chromedriver": "^2.43.0",
"selenium-webdriver": "^4.0.0-alpha.1"
}
According to the documentation I found here, it should to work
https://seleniumhq.github.io/selenium/docs/api/javascript/index.html
https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/lib/input_exports_Actions.html
Also found different example on web which support it should work, but cannot see what is missing in this basic example:
"use strict";
require('chromedriver');
const { Builder, By, Key, until, ActionSequence } = require('selenium-webdriver');
(async function run() {
let driver = await new Builder().forBrowser('chrome').build();
try {
await driver.get('http://www.google.com');
await driver
.actions()
.doubleClick(By.id('lst-ib'))
.perform();
}
finally {
await driver.quit();
}
})();
Also tested in a project with protractor and it seem to work, but I don't see why I would need protractor in this project since it does not use Angular.
Thanks
I found solution
i tried downgrade selenium-webdriver version 3.6.0
then, maybe it's possible working
and keydown method only 4 ways execute(i need use keyboard!)
key.CONTROL
key.SHIFT
key.ALT
key.COMMAND
so if you need another keyboard action, use sendKeys method(i used Tab key)
here i referenced link
https://github.com/SeleniumHQ/selenium/issues/5428