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

[backend] Fix entity pdf export message (#4193) #4215

Merged
merged 1 commit into from
Sep 6, 2023

Conversation

marieflorescontact
Copy link
Member

@marieflorescontact marieflorescontact commented Sep 1, 2023

Proposed changes

  • Fix entity pdf export message

Related issues

Checklist

  • I consider the submitted work as finished
  • I tested the code for its functionality
  • I wrote test cases for the relevant uses case
  • I added/update the relevant documentation (either on github or on notion)
  • Where necessary I refactored code to improve the overall quality

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

@marieflorescontact marieflorescontact self-assigned this Sep 1, 2023
@marieflorescontact marieflorescontact added the filigran team use to identify PR from the Filigran team label Sep 1, 2023
@tomibennett
Copy link
Contributor

tomibennett commented Sep 4, 2023

I had an issue when exporting a Threat actor group. Then the entity could not be accessed anymore on the plateform with the same error. Here's the log:

"TypeError: Cannot read properties of undefined (reading 'metaData')",
      "at /home/tom/softwares/filigran/opencti/opencti-platform/opencti-graphql/src/database/file-storage.js:357:27",
      "at Array.sort (<anonymous>)",
      "at resolveImageFiles (/home/tom/softwares/filigran/opencti/opencti-platform/opencti-graphql/src/database/file-storage.js:356:6)",
      "at filesListingFn (/home/tom/softwares/filigran/opencti/opencti-platform/opencti-graphql/src/database/file-storage.js:312:21)"

Maybe it's nothing, I'll try reproducing the issue and give update.

UPDATE: I could reproduce the error. Basically, it works well until the connector is reset (as shown in the screenshot). After, the backend starts firing traces when accessing the entity, fails and end with the above error. I did not dig the code to see what caused the bug, but it works well on master.

image

@marieflorescontact
Copy link
Member Author

I had an issue when exporting a Threat actor group. Then the entity could not be accessed anymore on the plateform with the same error.

I can't reproduce the error @tommychat

@marieflorescontact
Copy link
Member Author

Pr status: all comment have been taken in account .
I can't reproduce the bug found by @tommychat

@tomibennett
Copy link
Contributor

tomibennett commented Sep 5, 2023

I can't reproduce the bug found by @tommychat

I keep reproducing the error on my side, exporting a threat actor group (or individual) after resetting the connector yields the following response from the API, the export never finish and the entity can't be accessed anymore.

{
  "errors": [
    {
      "message": "Cannot read properties of undefined (reading 'metaData')",
      "locations": [
        {
          "line": 14,
          "column": 3
        }
      ],
      "path": [
        "stixCoreObject",
        "exportFiles"
      ],
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "exception": {
          "stacktrace": [
            "TypeError: Cannot read properties of undefined (reading 'metaData')",
            "    at /home/tom/softwares/filigran/opencti/opencti-platform/opencti-graphql/src/database/file-storage.js:357:27",
            "    at Array.sort (<anonymous>)",
            "    at resolveImageFiles (/home/tom/softwares/filigran/opencti/opencti-platform/opencti-graphql/src/database/file-storage.js:356:6)",
            "    at filesListingFn (/home/tom/softwares/filigran/opencti/opencti-platform/opencti-graphql/src/database/file-storage.js:312:21)"
          ]
        }
      }
    }
  ],
  "data": {
    "stixCoreObject": {
      "__typename": "ThreatActorIndividual",
      "__isStixCoreObject": "ThreatActorIndividual",
      "id": "8bae4557-c98d-411b-99dc-ae556776fbf3",
      "exportFiles": null
    }
  }
}

But we tested it on @marieflorescontact environment and it indeed didn't show up. Can someone else try to reproduce the error? We will be able to tell whether the issue is with my config or with the code. I'm available if further instruction is needed.

@SamuelHassine
Copy link
Member

@marieflorescontact @RomuDeuxfois is this PR fixing all types of export not displaying the "spinning" wheel?

  1. Go to https://testing.octi.staging.filigran.io/dashboard/analyses/reports/246a8e25-6b42-4c4d-a9bb-20e2a94803e8/files
  2. Export in JSON
  3. Line disappears until export is done (during 1 minutes)

?

@marieflorescontact
Copy link
Member Author

@marieflorescontact @RomuDeuxfois is this PR fixing all types of export not displaying the "spinning" wheel?

  1. Go to https://testing.octi.staging.filigran.io/dashboard/analyses/reports/246a8e25-6b42-4c4d-a9bb-20e2a94803e8/files
  2. Export in JSON
  3. Line disappears until export is done (during 1 minutes)

?

yes @SamuelHassine

@SouadHadjiat SouadHadjiat self-requested a review September 5, 2023 12:38
Copy link
Member

@SouadHadjiat SouadHadjiat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally ✅

@marieflorescontact marieflorescontact merged commit ea8fa9f into master Sep 6, 2023
6 checks passed
@marieflorescontact marieflorescontact deleted the issue/4193 branch September 6, 2023 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
filigran team use to identify PR from the Filigran team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants