-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PersistenceManager:default can't be resolved #47
Comments
Hey, I'm currently facing kinda the same issue, but with a slightly different log
It refers to the I'm trying to have nest, drivine and graphql running together, but when starting the app, it logs this error. (Afterward, I'll have some "service" files, but they does corresponds to the resolvers files like in the My current stack is:
When I'm cloning the repo Here is the app.module: @Module({
imports: [
ConfigModule.forRoot(),
GraphQLModule.forRoot({
typePaths: ['./**/*.graphql'],
definitions: {
path: join(process.cwd(), 'src/graphql.ts'),
},
include: [UserModule],
}),
DrivineModule.withOptions(<DrivineModuleOptions> {
connectionProviders: [DatabaseRegistry.buildOrResolveFromEnv()]
}),
UserModule,
],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {} and the user.resolver: @Injectable()
export class UserService {
constructor(
@InjectPersistenceManager() readonly persistenceManager: PersistenceManager,
) {}
async getAll (): Promise<User[]> {
const spec = new QuerySpecification<any>().withStatement(`
MATCH (user:User)
RETURN user
`);
return this.persistenceManager.query<any>(spec);
}
} then the .env
Also, I would like to say that I'm an utter beginner with nestjs, drivine, yarn2 and ts: I can't really say if this is the same error or just something different ._. |
Hello @Vincent-Alexandrine. Can you confirm once more that it was Drivine According to the error message, NestJS can't find But this infrastructureProviders(): Provider[] {
return [
<Provider>{ provide: DatabaseRegistry, useFactory: () => DatabaseRegistry.getInstance() },
<Provider>{ provide: TransactionContextHolder, useFactory: () => TransactionContextHolder.getInstance() },
PersistenceManagerFactory,
TransactionContextMiddleware,
TransactionalPersistenceManager,
NonTransactionalPersistenceManager
];
} ^-- There it is. So what is happening here? What we know so far:
Next StepsIs it possible you can sure the source of your app or create a cut down one that reproduces the problem? |
Hey @jasperblues , So I tried a couple of stuffs:
Neo4jConnectionProvider {
name: 'default',
type: 'NEO4J',
host: 'localhost',
port: 7687,
user: 'neo4j',
password: 'password',
database: 'eternes',
driver: Driver {
_id: 0,
_address: ServerAddress {
_host: 'localhost',
_resolved: null,
_port: 7687,
_hostPort: 'localhost:7687',
_stringValue: 'localhost:7687'
},
_userAgent: 'neo4j-javascript/4.2.1',
_authToken: { scheme: 'basic', principal: 'neo4j', credentials: 'password' },
_config: {
userAgent: 'neo4j-javascript/4.2.1',
maxConnectionLifetime: 3600000,
maxConnectionPoolSize: 100,
connectionAcquisitionTimeout: 60000,
fetchSize: 1000
},
_log: NoOpLogger { _level: null, _loggerFunction: null },
_connectionProvider: null
}
} The same is output when I do the same in the Was it what you were asking for ? |
Wild guess based on past experience: I suspect it might be the NestJS version. Can you try installing exactly the same version of Nest that the sample app uses? If this is it - great, use that for now, while I find a fix for all versions. |
I changed the nest version to the one in the drivine-inspiration (@nestjs/core, @nestjs/common, @nestjs/cli to ^7.4.4), but I'm still having the issue. Also I don't know if it could be related, but the yarn install fails to add |
Are you able to (privately) send the code or a sample app that reproduces the problem? |
I am having the same problem. Was this issue resolved ? |
All - this issue is closed. If you are having an issue, and you think it is a bug: Please post exactly what you have tried, what you expected to happen, what actually happened. If you need help learning Drivine: |
For anyone still having this problem. I was able to fix this by importing modules from Before (broken 👎) import { DrivineModule } from '@liberation-data/drivine/DrivineModule';
import { DatabaseRegistry } from '@liberation-data/drivine/connection/DatabaseRegistry'; After (working 👍) import { DrivineModule, DatabaseRegistry } from '@liberation-data/drivine'; At least, that is what fixed this for me 😊 |
I just wasted so much time on this, wish I had looked at @not-Ryan's response earlier. My IDE didn't grap the imports from @liberation-data/drivine and that minor difference changed it all. Thanks @not-Ryan that was huge. |
PersistenceManager:default can't be resolved if you don't use @InjectPersistenceManager() before DrivineModule.withOptions()
It was working be course we were importing Repositories with @InjectPersistenceManager() decorator, but if you run DrivineModule.withOptions() before importing the Repository, the default provider will be not defined
@jasperblues I'm working on the PR with e2e tests to illustrate the issue, if you can check it out, for you it should be quicker to debug
The text was updated successfully, but these errors were encountered: