1
votes

I am at this the third day now, but can't find the way to successfully use the AppDevPack on my local angular app. I am working on a Mac, I have Angular v 8.15.0. I was able to successfully install the library but when ever I wan't to compile it, it breaks. To describe: I've done almost everything to the script. The only difference is that I have made a service in which the @domino lives(it is not directly on a component). The main problem seems to be with grpc and then with stream.

import { Injectable } from '@angular/core';
//import { useServer } from '@domino/domino-db/';
import * as useServer from '../../../node_modules/@domino/domino-db';


@Injectable({
  providedIn: 'root'
})
export class DominoService {

  private serverConfig = {
    hostName: 'http://www.hostname.com/',
    connection: { port:'3002'}
  };

  private databaseConfig = {
    filePath: 'dev-tmp.nsf'
  };

  public database: any;

  constructor() {
    useServer( this.serverConfig ).then( async server => {
      this.database = await server.useDatabase( this.databaseConfig );
    });

    const coll = this.database.bulkReadDocuments({
      query: "Form = 'Document'"
    });
    console.log("Returned docs:" + JSON.stringify(coll));

  }

Here are some of the errors:

Critical dependency: the request of a dependency is an expression

WARNING in ./node_modules/@domino/domino-db/node_modules/grpc/node_modules/node-pre-gyp/lib/pre-binding.js 20:22-48 Critical dependency: the request of a dependency is an expression

WARNING in ./node_modules/@domino/domino-db/node_modules/grpc/node_modules/node-pre-gyp/lib/util/versioning.js 17:20-67 Critical dependency: the request of a dependency is an expression

WARNING in ./node_modules/@domino/domino-db/node_modules/grpc/node_modules/minimatch/minimatch.js Module not found: Error: Can't resolve 'path' in '/Users/…/node_modules/@domino/domino-db/node_modules/grpc/node_modules/minimatch'

ERROR in ./node_modules/@domino/domino-db/node_modules/grpc/node_modules/detect-libc/lib/detect-libc.js Module not found: Error: Can't resolve 'child_process' in ‘/…/node_modules/@domino/domino-db/node_modules/grpc/node_modules/detect-libc/lib' Error: Can't resolve 'path' in '/Users/.../node_modules/@domino/domino-db/node_modules/grpc/node_modules/minimatch' ERROR in ./node_modules/@domino/domino-db/node_modules/grpc/node_modules/detect-libc/lib/detect-libc.js Module not found: Error: Can't resolve 'child_process' in '/Users/.../node_modules/@domino/domino-db/node_modules/grpc/node_modules/detect-libc/lib' ERROR in ./node_modules/@domino/domino-db/node_modules/grpc/src/client.js Module not found: Error: Can't resolve 'stream' in '/Users/.../node_modules/@domino/domino-db/node_modules/grpc/src'

1
That error doesn't look familiar. What version of Node are you using? domino-db was tested with Node 8.x.Dave Delay
I have a question and some comments about your code. Why is the require for domino-db using a relative path? Your call to this.database.bulkReadDocuments needs to be done in the then of the useServer promise. All of our functions are async so they must be awaited or chained as promises. Similarly, you must also await the this.database.bulkReadDocuments before you use coll. I would not do this in a constructor, because it can't be async, so you have to use promise chaining (at least for the useServer call).ddumont
Also, are you trying to webpack this code?ddumont
Regarding my code. I did not really give it much attention. I was really just frustrated with the installation. I've tried with Node 11, 10, and 8.14. Nothing worked. However, I will try and reinstall npm and node and do everything from scratch.dregos
Ok I get it now. I need something for serverside comunication. Like Express.dregos

1 Answers

4
votes

Critical dependency: the request of a dependency is an expression

From the error message, I can see that you're trying to webpack this. We do not support running domino-db on a webpage. Even if you got past this error, domino-db would fail to load in that environment because it's insecure.

Domino-db in production, secure environments requires client credentials to log in. Those aren't things you want to appear in the browser page.