XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Netbox plugin: Error code 400 - Error: Bad Request

    Scheduled Pinned Locked Moved Advanced features
    32 Posts 4 Posters 8.0k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M Offline
      mavoff
      last edited by mavoff

      Hiya,

      Decided to configure the Netbox plugin. I followed Xen Orchestra documentation to configure the plugin, the prefixes already existed.

      Custom fields are slightly different on my installation from the screenshots, nevertheless these seem irrelevant.

      Screenshot 2023-10-17 at 15.50.52.png

      After configuring the plugin on XO, when I hit "Test plugin" I get:

      plugin.test
      {
        "id": "netbox"
      }
      {
        "code": 400,
        "url": "https://fw-dea12.domain.tld:8143/api/virtualization/cluster-types/",
        "data": {
          "method": "POST",
          "path": "/virtualization/cluster-types/",
          "body": {
            "name": "[TMP] Xen Orchestra Netbox plugin test - 5ttlql89h",
            "slug": "xo-test-5ttlql89h",
            "description": "This type has been created by Xen Orchestra's Netbox plugin test. If it hasn't been properly deleted, you may delete it manually."
          }
        },
        "message": "Bad Request",
        "name": "Error",
        "stack": "Error: Bad Request
          at onResponse (/opt/xen-orchestra/node_modules/http-request-plus/index.js:255:21)
          at AsyncResource.runInAsyncScope (node:async_hooks:199:9)
          at cb (/opt/xen-orchestra/node_modules/bluebird/js/release/util.js:355:42)
          at tryCatcher (/opt/xen-orchestra/node_modules/bluebird/js/release/util.js:16:23)
          at Promise._settlePromiseFromHandler (/opt/xen-orchestra/node_modules/bluebird/js/release/promise.js:547:31)
          at Promise._settlePromise (/opt/xen-orchestra/node_modules/bluebird/js/release/promise.js:604:18)
          at Promise._settlePromise0 (/opt/xen-orchestra/node_modules/bluebird/js/release/promise.js:649:10)
          at Promise._settlePromises (/opt/xen-orchestra/node_modules/bluebird/js/release/promise.js:729:18)
          at _drainQueueStep (/opt/xen-orchestra/node_modules/bluebird/js/release/async.js:93:12)
          at _drainQueue (/opt/xen-orchestra/node_modules/bluebird/js/release/async.js:86:9)
          at Async._drainQueues (/opt/xen-orchestra/node_modules/bluebird/js/release/async.js:102:5)
          at Immediate.Async.drainQueues [as _onImmediate] (/opt/xen-orchestra/node_modules/bluebird/js/release/async.js:15:14)
          at processImmediate (node:internal/timers:464:21)
          at process.callbackTrampoline (node:internal/async_hooks:130:17)"
      }
      

      Any thoughts appreciated, thanks!

      EDIT:
      I only found one topic which seems close to my issue and its a bit old.
      Netbox version: 3.4.6

      1 Reply Last reply Reply Quote 0
      • olivierlambertO Online
        olivierlambert Vates 🪐 Co-Founder CEO
        last edited by

        Hi,
        As usual when one is creating a thread to report something: https://xen-orchestra.com/docs/community.html#current-version

        Without knowing the version of XO you use, it's hard to answer 🙂 I saw you edited to add your Netbox version, it's already better 🙂

        M 1 Reply Last reply Reply Quote 1
        • olivierlambertO olivierlambert moved this topic from Xen Orchestra on
        • M Offline
          mavoff @olivierlambert
          last edited by mavoff

          @olivierlambert sorry, ok forgot to mention the latest xo available, updated before posting the issue with git checkout pull --ff-only yarn and build.

          xo-server 5.102.3
          xo-web 5.103.0

          1 Reply Last reply Reply Quote 0
          • olivierlambertO Online
            olivierlambert Vates 🪐 Co-Founder CEO
            last edited by olivierlambert

            Commit number matters now, not version anymore. Should be available soon in your XO interface BTW, something like:

            Anyway, if you are on the latest commit on master, @pdonias will take a quick look. I double-checked in our prod, and the plugin is working correctly. I can assume a configuration issue somewhere.

            M 1 Reply Last reply Reply Quote 1
            • M Offline
              mavoff @olivierlambert
              last edited by

              @olivierlambert
              commit dd0b7

              Screenshot 2023-10-17 at 16.54.50.png

              Thanks and sorry for not adding all that from the start.

              pdoniasP 1 Reply Last reply Reply Quote 0
              • pdoniasP Offline
                pdonias Vates 🪐 XO Team @mavoff
                last edited by

                Hi @maverick, that commit is from September 2022, are you sure you properly fetched the last changes?

                git checkout master
                git pull --ff-only
                yarn
                yarn build
                
                M 1 Reply Last reply Reply Quote 0
                • olivierlambertO Online
                  olivierlambert Vates 🪐 Co-Founder CEO
                  last edited by

                  haha September 22 is little bit old, indeed, that might explain the issue 😄

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    mavoff @pdonias
                    last edited by mavoff

                    @pdonias thank you for your reply.

                    I am sorry to say I was not 😭

                    # git branch
                    * fix_fuse_dependancy_arm
                      master
                    

                    updating now ... will let you know in a jiffy

                    1 Reply Last reply Reply Quote 0
                    • olivierlambertO Online
                      olivierlambert Vates 🪐 Co-Founder CEO
                      last edited by

                      That will be a big jump for you then 😛

                      M 1 Reply Last reply Reply Quote 0
                      • M Offline
                        mavoff @olivierlambert
                        last edited by mavoff

                        @olivierlambert

                        unfortunately not progressing

                        # yarn
                        yarn install v1.22.19
                        warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
                        [1/5] Validating package.json...
                        [2/5] Resolving packages...
                        [3/5] Fetching packages...
                        error lint-staged@14.0.1: The engine "node" is incompatible with this module. Expected version "^16.14.0 || >=18.0.0". Got "16.13.0"
                        error Found incompatible module.
                        info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
                        

                        updating node

                        M 1 Reply Last reply Reply Quote 0
                        • M Offline
                          mavoff @mavoff
                          last edited by

                          # yarn
                          yarn install v1.22.19
                          warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
                          [1/5] Validating package.json...
                          [2/5] Resolving packages...
                          [3/5] Fetching packages...
                          [4/5] Linking dependencies...
                          warning "workspace-aggregator-8a1904ad-6260-4eb8-b5d4-0d47e2dea9f0 > @vates/node-vsphere-soap > soap@1.0.0" has incorrect peer dependency "axios@^0.27.2".
                          warning Workspaces can only be enabled in private projects.
                          [5/5] Building fresh packages...
                          [1/19] ⠁ core-js
                          [6/19] ⠁ vue-demi
                          [3/19] ⠁ esbuild
                          [4/19] ⠁ fuse-native
                          error /opt/xen-orchestra/node_modules/fuse-native: Command failed.
                          Exit code: 1
                          Command: node-gyp-build
                          Arguments: 
                          Directory: /opt/xen-orchestra/node_modules/fuse-native
                          Output:
                          node:events:495
                                throw er; // Unhandled 'error' event
                                ^
                          
                          Error: spawn node-gyp ENOENT
                              at ChildProcess._handle.onexit (node:internal/child_process:284:19)
                              at onErrorNT (node:internal/child_process:477:16)
                              at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
                          Emitted 'error' event on ChildProcess instance at:
                              at ChildProcess._handle.onexit (node:internal/child_process:290:12)
                              at onErrorNT (node:internal/child_process:477:16)
                              at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
                            errno: -2,
                            code: 'ENOENT',
                            syscall: 'spawn node-gyp',
                            path: 'node-gyp',
                            spawnargs: [ 'rebuild' ]
                          

                          Is this related to the fuse arm dependency?

                          1 Reply Last reply Reply Quote 0
                          • olivierlambertO Online
                            olivierlambert Vates 🪐 Co-Founder CEO
                            last edited by

                            As stated in the doc, current Node LTS is required 🙂 (so that's normal it doesn't work on Node 16)

                            About the dep, I don't know, on what kind of machine you are building it?

                            M 1 Reply Last reply Reply Quote 0
                            • M Offline
                              mavoff @olivierlambert
                              last edited by mavoff

                              @olivierlambert already updated node to latest lts

                              Its an ARM instance.

                              https://xcp-ng.org/forum/topic/6344/libfuse-so-error-adding-symbols-file-in-wrong-format

                              1 Reply Last reply Reply Quote 0
                              • olivierlambertO Online
                                olivierlambert Vates 🪐 Co-Founder CEO
                                last edited by olivierlambert

                                Since we do not make tests on it (for now), you'll have to isolate the dependencies that aren't working with it to workaround that 🙂

                                edit: it seems related to fuse-native in your case

                                M 1 Reply Last reply Reply Quote 0
                                • M Offline
                                  mavoff @olivierlambert
                                  last edited by

                                  @sorry Olivier I'm not sure what you mean by isolate the dependency so I won't be able to use fuse for mounts?
                                  Has the arm fix branch been merged?

                                  1 Reply Last reply Reply Quote 0
                                  • olivierlambertO Online
                                    olivierlambert Vates 🪐 Co-Founder CEO
                                    last edited by

                                    I mean to remove the dep/package so you can build. The branch is not rebased on master since 1093 commits. You can try to do it by yourself and see if you can build after rebasing it.

                                    About merging it: sadly, we do not have the resources to check/investigate and solve build issue on any other platform than x86 at the moment. I prepared a Arm instance for Florent last year, but we have many other things with a higher priority right now. However, contributions are welcome 🙂

                                    M 1 Reply Last reply Reply Quote 0
                                    • M Offline
                                      mavoff @olivierlambert
                                      last edited by

                                      @olivierlambert as you know I'm not a developer and cannot contribute with code or fixes.
                                      Thanks...

                                      1 Reply Last reply Reply Quote 0
                                      • M mavoff referenced this topic on
                                      • M Offline
                                        mavoff
                                        last edited by mavoff

                                        Screenshot 2023-10-24 at 10.45.12.png

                                        XO up to date now

                                        plugin.test
                                        {
                                          "id": "netbox"
                                        }
                                        {
                                          "originalUrl": "https://fw-dea12.domain.tld:8143/api/extras/custom-fields/",
                                          "url": "https://fw-dea12.domain.tld:8143/api/extras/custom-fields/",
                                          "data": {
                                            "method": "GET",
                                            "path": "/extras/custom-fields/"
                                          },
                                          "message": "400 Bad Request",
                                          "name": "Error",
                                          "stack": "Error: 400 Bad Request
                                            at Object.assertSuccess (/opt/xen-orchestra/node_modules/http-request-plus/index.js:162:19)
                                            at httpRequestPlus (/opt/xen-orchestra/node_modules/http-request-plus/index.js:217:22)
                                            at httpRequest (/opt/xen-orchestra/packages/xo-server-netbox/src/index.js:146:26)
                                            at Netbox.#request (/opt/xen-orchestra/packages/xo-server-netbox/src/index.js:183:18)
                                            at Netbox.#checkCustomFields (/opt/xen-orchestra/packages/xo-server-netbox/src/index.js:203:26)
                                            at Netbox.test (/opt/xen-orchestra/packages/xo-server-netbox/src/index.js:106:5)
                                            at default.testPlugin (file:///opt/xen-orchestra/packages/xo-server/src/xo-mixins/plugins.mjs:285:5)
                                            at Xo.test (file:///opt/xen-orchestra/packages/xo-server/src/api/plugin.mjs:109:3)
                                            at Api.#callApiMethod (file:///opt/xen-orchestra/packages/xo-server/src/xo-mixins/api.mjs:417:20)"
                                        }
                                        

                                        Still giving the same 400 bad request error

                                        DanpD pdoniasP 2 Replies Last reply Reply Quote 0
                                        • DanpD Online
                                          Danp Pro Support Team @mavoff
                                          last edited by

                                          @maverick said in Netbox plugin: Error code 400 - Error: Bad Request:

                                          XO up to date now

                                          Something appears to be wrong because the version of xo=server is way off (should be 5.124.0)

                                          1 Reply Last reply Reply Quote 0
                                          • pdoniasP Offline
                                            pdonias Vates 🪐 XO Team @mavoff
                                            last edited by

                                            Nice catch @Danp 🙂
                                            @maverick, maybe you forgot to restart xo-server?

                                            M 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post