Skip to content
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

LibraryCheckService: Error trying to save libraries on database #7

Open
1 of 3 tasks
brataaaan opened this issue Apr 24, 2024 · 4 comments
Open
1 of 3 tasks
Labels
bug Something isn't working

Comments

@brataaaan
Copy link

brataaaan commented Apr 24, 2024

Description

When I tested plugin local (better-sqlite), the plugins does not work. It seems to have problems with saving the metadata to the database with err message LibraryCheckService: Error trying to save libraries on database.

Link to Reproduction

https://example.com

Steps to reproduce

Using the newest Version (Backend 0.1.0) of the plugin with Backstage 1.23.2.

// backend/src/index.ts

import libraryCheck from './plugins/libraryCheck';
// ...

const libraryCheckEnv = useHotMemoize(module, () =>
  createEnv('libraryCheck'),
);
// ...

apiRouter.use('/library-check', await libraryCheck(libraryCheckEnv));
// backend/src/plugins/libraryCheck.ts

import { PluginEnvironment } from '../types';
import { Router } from 'express';
import {
  DatabaseLibraryCheckStore,
  createRouter,
} from '@anakz/backstage-plugin-library-check-backend';

export default async function createPlugin({
  logger,
  database,
  config,
}: PluginEnvironment): Promise<Router> {
  const db = await DatabaseLibraryCheckStore.create({
    database: database,
  });
  return await createRouter({
    logger,
    database: db,
    config,
  });
}
// backend/src/plugins/catalog.ts

import {
  LibraryCheckProcessor,
  LibraryCheckProvider,
  LibraryCheckUpdaterProcessor,
} from '@anakz/backstage-plugin-library-check-backend';

// ...

  builder.addEntityProvider(
    LibraryCheckProvider.fromConfig({
      envId: 'production',
      logger: env.logger,
      discovery: env.discovery,
      schedule: env.scheduler.createScheduledTaskRunner({
        initialDelay: {
          seconds: 30,
        },
        frequency: {
          minutes: 60,
        },
        timeout: {
          minutes: 1,
        },
      }),
    }),
  );

  builder.addProcessor(
    LibraryCheckProcessor.fromConfig(env.config, {
      discoveryService: env.discovery,
      reader: env.reader,
      logger: env.logger,
    }),
    LibraryCheckUpdaterProcessor.fromConfig(env.config, {
      discoveryService: env.discovery,
      reader: env.reader,
      logger: env.logger,
    }),
  );

// ...

Plugin Version

0.1.0

Browser

No response

Operating System

  • macOS
  • Windows
  • Linux

Additional Information

No response

@accezar
Copy link
Contributor

accezar commented Apr 30, 2024

Hi @brataaaan For these first versions, it only supports PostgreSQL.
I will work on additional support on the next versions.

Thank you for your collaboration ❤️

@accezar accezar added the bug Something isn't working label Apr 30, 2024
@brataaaan
Copy link
Author

@accezar Thanks for building this & coming back to my issue.

Have switched to Postgres provider and at least it boots up, but still has error msg 'LibraryCheckService: Error trying to save libraries on database'.

Any ideas why?

@accezar
Copy link
Contributor

accezar commented May 3, 2024

Hi @brataaaan sorry to hear this. Could be something related to the schema or migrations. Can you provide a log sample for me to understand better?

@brataaaan
Copy link
Author

Hey @accezar,

here is the log:

[1] 2024-05-06T14:03:11.580Z backstage info ::1 - - [06/May/2024:14:03:11 +0000] "POST /api/library-check/libraries-updates HTTP/1.1" 400 505 "-" "axios/1.6.8" type=incomingRequest
[1] LibraryCheckService: Error trying to update libraries occurrences records on entities_libraries table AxiosError: Request failed with status code 400

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants