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

Converting a MOS object with a circular structure #83

Closed
PascalViauRC opened this issue Dec 13, 2023 · 3 comments
Closed

Converting a MOS object with a circular structure #83

PascalViauRC opened this issue Dec 13, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@PascalViauRC
Copy link
Contributor

  • I'm submitting a ...
    [x] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

I'm doing some tests with an iNews Mos Gateway. When there is no MOS object in the stories, everything works fine. When I add a MOS object to a story, I get this error while it converts XML to JSON :

TypeError: Converting circular structure to JSON\n --> starting at object with constructor 'Object'\n | property 'mos' -> object with constructor 'Object'\n --- property 'parent' closes the circle

The problem seems to be that the iNews MOS object starts with the same <mos> root tag than the iNews story itself :

<mos>
  ...
    <roStorySend>
    ...
      <mosExternalMetadata>
        <mosPayload>
        ...
          <nsml xmlns:nsml="http://www.avid.com">
          ...
            <aeset-atts>
              <attachment id="1">
                <AttachmentContent>
                  <mos>
                    <mosID>
		         VIZRT
	            </mosID>
                     ...
                  </mos>
                </AttachmentContent>
              </attachment>
            </aeset-atts>
         </nsml>
      </mosPayload>
    </mosExternalMetadata>
  </roStorySend>
</mos>

When I replace the MOS object first tag (<mos>) by a modified tag (<_mos>), it fixes the problem :

<mos>
  ...
    <roStorySend>
    ...
      <mosExternalMetadata>
        <mosPayload>
        ...
          <nsml xmlns:nsml="http://www.avid.com">
          ...
            <aeset-atts>
              <attachment id="1">
                <AttachmentContent>
                  <_mos>
                    <mosID>
		         VIZRT
	            </mosID>
                     ...
                  </_mos>
                </AttachmentContent>
              </attachment>
            </aeset-atts>
         </nsml>
      </mosPayload>
    </mosExternalMetadata>
  </roStorySend>
</mos>

If you want me to submit a pull request with the code I used to fix the problem, let me know !

@nytamin
Copy link
Contributor

nytamin commented Dec 14, 2023

hmm, that's a strange bug indeed!

I did a little digging and it seems like there is a bug in the code that deals with reading the incoming message chunks. I think I've found the root cause and have implemented a fix in the PR #85.

@PascalViauRC would you be able to give that a spin (npm install @mos-connection/connector@3.0.5-nightly-fix-multiple-mos-tags-20231214-120351-59cacb2.0), to see if it helps?

@nytamin nytamin added the bug Something isn't working label Dec 14, 2023
@PascalViauRC
Copy link
Contributor Author

@nytamin It fixes the problem, thanks !

@nytamin nytamin closed this as completed Dec 18, 2023
@nytamin
Copy link
Contributor

nytamin commented Dec 18, 2023

The fix for this is now published in version 3.0.6

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