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

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'assets.' in 'where clause' #10702

Closed
2 tasks done
palmeraeasd opened this issue Feb 18, 2022 · 24 comments
Closed
2 tasks done
Assignees

Comments

@palmeraeasd
Copy link

Debug mode

Describe the bug

When viewing certain assets server error 500 happens. Enabling debug results in:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'assets.' in 'where clause' (SQL: select * from assets where assets.`` = 1125 limit 1) (View: /var/www/html/snipeit/resources/views/hardware/view.blade.php)

Reproduction steps

  1. view an asset that exhibits this behavior

...

Expected behavior

The asset view page will come up

Screenshots

No response

Snipe-IT Version

Unsure, I have run upgrade.php so I assume the latest?

Operating System

Ubuntu

Web Server

Apache

PHP Version

7.4.3

Operating System

MacOS

Browser

Chrome

Version

98

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'assets.' in 'where clause' (SQL: select * from `assets` where `assets`.`` = 1125 limit 1) (View: /var/www/html/snipeit/resources/views/hardware/view.blade.php)

/var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Database/Connection.php
     * @param  array  $bindings
     * @param  \Closure  $callback
     * @return mixed
     *
     * @throws \Illuminate\Database\QueryException
     */
    protected function runQueryCallback($query, $bindings, Closure $callback)
    {
        // To execute the statement, we'll simply call the callback, which will actually
        // run the SQL against the PDO connection. Then we can calculate the time it
        // took to execute and log the query SQL, bindings and time in our memory.
        try {
            $result = $callback($query, $bindings);
        }
 
        // If an exception occurs when attempting to run a query, we'll format the error
        // message to include the bindings with SQL, which will make this exception a
        // lot more helpful to the developer instead of just the database's errors.
        catch (Exception $e) {
            throw new QueryException(
                $query, $this->prepareBindings($bindings), $e
            );
        }
 
        return $result;
    }
 
    /**
     * Log a query in the connection's query log.
     *
     * @param  string  $query
     * @param  array  $bindings
     * @param  float|null  $time
     * @return void
     */
    public function logQuery($query, $bindings, $time = null)
    {
        $this->event(new QueryExecuted($query, $bindings, $time, $this));
 
        if ($this->loggingQueries) {
Arguments
"SQLSTATE[42S22]: Column not found: 1054 Unknown column 'assets.' in 'where clause' (SQL: select * from `assets` where `assets`.`` = 1125 limit 1) (View: /var/www/html/snipeit/resources/views/hardware/view.blade.php) ◀"

Additional context

Happened before and after upgrade
I have not manually edited the database
I have ran the commands on common issues page

@welcome
Copy link

welcome bot commented Feb 18, 2022

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

@uberbrady
Copy link
Collaborator

If you look at storage/logs/laravel.log you might have a little more information for us in your backtrace.

But I bet if you run php artisan tinker and then try something like App\Models\Asset::withTrashed()->find(1125) you'll get output, because I suspect this is something in the view itself (the blade), not the controller.

The only other thing that seems like it's variable based on which asset you're looking at is "Currency" - which would differ based on what location the asset was currently at, I suppose? If you go into Settings, Localization, and set a default currency - does the problem go away?

@palmeraeasd
Copy link
Author

@uberbrady Thank you for the response!

Here is the output of the php artisan tinker. I should also have included that the API returns the asset info without error and that I am creating assets via the API:

App\Models\Asset::withTrashed()->find(1125)
=> App\Models\Asset {#5072
id: 1125,
name: null,
asset_tag: "17036",
model_id: 1,
serial: "[removed for github post]",
purchase_date: null,
purchase_cost: null,
order_number: null,
assigned_to: null,
notes: null,
image: null,
user_id: 2,
created_at: "2022-02-01 13:38:01",
updated_at: "2022-02-18 11:18:48",
physical: 1,
deleted_at: null,
status_id: 2,
archived: 0,
warranty_months: null,
depreciate: 0,
supplier_id: null,
requestable: 0,
rtd_location_id: null,
accepted: null,
last_checkout: null,
expected_checkin: null,
company_id: null,
assigned_type: null,
last_audit_date: null,
next_audit_date: null,
location_id: null,
checkin_counter: 0,
checkout_counter: 0,
requests_counter: 0,
_snipeit_room_number_2: null,
_snipeit_static_ip_address_3: null,
_snipeit_wifi_mac_address_4: "[removed for github post]",
_snipeit_lost_mode_enabled_5: "No",
_snipeit_os_version_6: "14.6",
}

From laravel.log:

[previous exception] [object] (PDOException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'assets.' in 'where clause' at /var/www/html/snipeit/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:79)
[stacktrace]
#0 /var/www/html/snipeit/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(79): PDO->prepare()
#1 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Database/Connection.php(331): Doctrine\DBAL\Driver\PDOConnection->prepare()
#2 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Database/Connection.php(662): Illuminate\Database\Connection->Illuminate\Database\{closure}()
#3 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Database/Connection.php(629): Illuminate\Database\Connection->runQueryCallback()
#4 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Database/Connection.php(338): Illuminate\Database\Connection->run()
#5 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2159): Illuminate\Database\Connection->select()
#6 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2147): Illuminate\Database\Query\Builder->runSelect()
#7 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2619): Illuminate\Database\Query\Builder->Illuminate\Database\Query\{closure}()
#8 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2148): Illuminate\Database\Query\Builder->onceWithColumns()
#9 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(546): Illuminate\Database\Query\Builder->get()
#10 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(530): Illuminate\Database\Eloquent\Builder->getModels()
#11 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Database/Concerns/BuildsQueries.php(143): Illuminate\Database\Eloquent\Builder->get()
#12 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php(83): Illuminate\Database\Eloquent\Builder->first()
#13 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php(429): Illuminate\Database\Eloquent\Relations\BelongsTo->getResults()
#14 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php(401): Illuminate\Database\Eloquent\Model->getRelationshipFromMethod()
#15 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php(333): Illuminate\Database\Eloquent\Model->getRelationValue()
#16 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1527): Illuminate\Database\Eloquent\Model->getAttribute()
#17 /var/www/html/snipeit/storage/framework/views/d01504e9d46044fae88019f80f1a9dde4862a43f.php(228): Illuminate\Database\Eloquent\Model->__get()
#18 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(43): include('/var/www/html/s...')
#19 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(59): Illuminate\View\Engines\PhpEngine->evaluatePath()
#20 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/View/View.php(143): Illuminate\View\Engines\CompilerEngine->get()
#21 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/View/View.php(126): Illuminate\View\View->getContents()
#22 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/View/View.php(91): Illuminate\View\View->renderContents()
#23 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Http/Response.php(42): Illuminate\View\View->render()
#24 /var/www/html/snipeit/vendor/symfony/http-foundation/Response.php(205): Illuminate\Http\Response->setContent()
#25 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Router.php(749): Symfony\Component\HttpFoundation\Response->__construct()
#26 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Router.php(721): Illuminate\Routing\Router::toResponse()
#27 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Router.php(681): Illuminate\Routing\Router->prepareResponse()
#28 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(130): Illuminate\Routing\Router->Illuminate\Routing\{closure}()
#29 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php(43): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#30 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Auth\Middleware\Authenticate->handle()
#31 /var/www/html/snipeit/app/Http/Middleware/AssetCountForSidebar.php(56): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#32 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): App\Http\Middleware\AssetCountForSidebar->handle()
#33 /var/www/html/snipeit/vendor/laravel/passport/src/Http/Middleware/CreateFreshApiToken.php(50): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#34 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Laravel\Passport\Http\Middleware\CreateFreshApiToken->handle()
#35 /var/www/html/snipeit/app/Http/Middleware/CheckForTwoFactor.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#36 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): App\Http\Middleware\CheckForTwoFactor->handle()
#37 /var/www/html/snipeit/app/Http/Middleware/CheckLocale.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#38 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): App\Http\Middleware\CheckLocale->handle()
#39 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(78): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#40 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle()
#41 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#42 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle()
#43 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#44 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Cookie\Middleware\EncryptCookies->handle()
#45 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(105): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#46 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Router.php(683): Illuminate\Pipeline\Pipeline->then()
#47 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Router.php(658): Illuminate\Routing\Router->runRouteWithinStack()
#48 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Router.php(624): Illuminate\Routing\Router->runRoute()
#49 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Routing/Router.php(613): Illuminate\Routing\Router->dispatchToRoute()
#50 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(170): Illuminate\Routing\Router->dispatch()
#51 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(130): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}()
#52 /var/www/html/snipeit/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#53 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Barryvdh\Debugbar\Middleware\InjectDebugbar->handle()
#54 /var/www/html/snipeit/app/Http/Middleware/PreventBackHistory.php(23): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#55 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): App\Http\Middleware\PreventBackHistory->handle()
#56 /var/www/html/snipeit/app/Http/Middleware/SecurityHeaders.php(26): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#57 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): App\Http\Middleware\SecurityHeaders->handle()
#58 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#59 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()
#60 /var/www/html/snipeit/app/Http/Middleware/CheckForDebug.php(25): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#61 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): App\Http\Middleware\CheckForDebug->handle()
#62 /var/www/html/snipeit/app/Http/Middleware/CheckForSetup.php(26): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#63 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): App\Http\Middleware\CheckForSetup->handle()
#64 /var/www/html/snipeit/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#65 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Fideloper\Proxy\TrustProxies->handle()
#66 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#67 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\View\Middleware\ShareErrorsFromSession->handle()
#68 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(56): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#69 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Session\Middleware\StartSession->handle()
#70 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(63): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#71 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle()
#72 /var/www/html/snipeit/app/Http/Middleware/NoSessionStore.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#73 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): App\Http\Middleware\NoSessionStore->handle()
#74 /var/www/html/snipeit/vendor/barryvdh/laravel-cors/src/HandlePreflight.php(29): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#75 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Barryvdh\Cors\HandlePreflight->handle()
#76 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(105): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#77 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(145): Illuminate\Pipeline\Pipeline->then()
#78 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(110): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter()
#79 /var/www/html/snipeit/public/index.php(58): Illuminate\Foundation\Http\Kernel->handle()
#80 {main}
"}

@yosiasz
Copy link

yosiasz commented Feb 22, 2022

How did you upgrade?

@palmeraeasd
Copy link
Author

@yosiasz From the command line with php upgrade.php which finished without errors.

@yosiasz
Copy link

yosiasz commented Feb 22, 2022

Using the rest api, or snipeit UI which hardware is id = 1125 . That asset has something off in the data. Missing a required column? Not sure how if the query is created dynamically but there is a missing column in that query that is erroring out.

@snipe
Copy link
Owner

snipe commented Feb 22, 2022

@inietov I thought we fixed this issue - can you take a look today?

@palmeraeasd You said "Unsure, I have run upgrade.php so I assume the latest?" - "latest" can mean anything at any given time. Always make sure to look in the footer of your Snipe-IT, or in your Admin Settings for the precise version and hash.

@snipe
Copy link
Owner

snipe commented Feb 22, 2022

@yosiasz

Missing a required column?

No, that's not it - we do some complicated joins in those queries.

@palmeraeasd
Copy link
Author

@snipe Sorry, I didn't know where to check for that info.

Info from the admin settings page:
Snipe-IT version: v5.3.10 build 6684 (g05c081977)
PHP Version: 7.4.3
Laravel Version: 6.20.29

Thank you for helping with this.

@snipe
Copy link
Owner

snipe commented Feb 22, 2022

Can you tell me what's on line 228 of /var/www/html/snipeit/storage/framework/views/d01504e9d46044fae88019f80f1a9dde4862a43f.php?

@palmeraeasd
Copy link
Author

@snipe
sed -n 228p /var/www/html/snipeit/storage/framework/views/d01504e9d46044fae88019f80f1a9dde4862a43f.php

                                            <?php if(($asset->assignedTo) && ($asset->deleted_at=='')): ?>

@snipe
Copy link
Owner

snipe commented Feb 22, 2022

This is usually a data problem. It means that there is no record for what type of entity the asset was checked out to, so it doesn't know what table to query. I'd bet if you queried the asset_logs table for all records with item_id=1125, you'll see a blank entry for target_type on the last checkout, OR if you query the assets table for id=1125 you'll see an assigned_type that is null. Do you have mysql access so you can confirm this?

@palmeraeasd
Copy link
Author

It's saying asset_logs is empty:

MariaDB [snipeit]> select * from asset_logs;
Empty set (0.000 sec)

@snipe
Copy link
Owner

snipe commented Feb 22, 2022

Apologies, I meant action_logs - we renamed that table ages ago

@palmeraeasd
Copy link
Author

assigned_type is NULL for asset 1125 from the assets table

target_type is NULL for both entries for this asset in the action_logs table with "create" and "update" actions_types

@snipe
Copy link
Owner

snipe commented Feb 22, 2022

assigned_type is NULL for asset 1125 from the assets table

But there is an assigned_to value, right? Try updating that with App\Models\User if it is in fact a user it was checked out to.

Create and update wouldn't warrant a target_type, only a checkout would, so the action_logs field is probably fine.

@palmeraeasd
Copy link
Author

But there is an assigned_to value, right

No, the asset is unassigned. The assigned_to value is NULL

@snipe
Copy link
Owner

snipe commented Feb 22, 2022

Huh. What about target_id in the action_logs?

@palmeraeasd
Copy link
Author

Huh. What about target_id in the action_logs?

NULL for both entries

@snipe snipe changed the title SQLSTATE[42S22]: Column not found: 1054 Unknown column 'assets.' in 'where clause' (SQL: select * from assets where assets.`` = 1125 limit 1) (View: /var/www/html/snipeit/resources/views/hardware/view.blade.php) SQLSTATE[42S22]: Column not found: 1054 Unknown column 'assets.' in 'where clause' Feb 22, 2022
@snipe
Copy link
Owner

snipe commented Feb 22, 2022

That's... very curious. Those are the only two places where I can remember us using dynamic pivots (the MorphTo() method in Laravel).

Does this only happen on 1125, or on other assets as well? How did the asset get into the system? API, GUI, CSV import, etc?

@snipe
Copy link
Owner

snipe commented Feb 22, 2022

Also, if you change line 822 of resources/views/hardware/view.blade.php from:

@if (($asset->assignedTo) && ($asset->deleted_at==''))

to

@if (($asset->assigned_to!='') && ($asset->assignedTo) && ($asset->deleted_at==''))

does that fix the error?

@palmeraeasd
Copy link
Author

It happens on more than one asset. I have only found two from just clicking around. I made the change in view.blade.php but it does not change the error. Here is how I add assets via the API in a bash script:

			RESULT=$(curl -s --request POST \
			     --url https://[removed for github post]/api/v1/hardware \
			     --header 'Accept: application/json' \
			     --header 'Authorization: Bearer [removed for github post]' \
			     --header 'Content-Type: application/json' \
			     --data "
			{
			     \"asset_tag\": \"$Asset_Tag\",
			     \"status_id\": \"2\",
			     \"model_id\": \"$MODEL_ID\",
			     \"serial\": \"$Serial_Number\",
			     \"assigned_user\":\"$USER_ID\",
			     \"_snipeit_wifi_mac_address_4\":\"$MAC_Address\",
			     \"_snipeit_lost_mode_enabled_5\":\"$Lost_Mode_Enabled\"

			}")

$USER_ID is blank if it is unassigned

@palmeraeasd
Copy link
Author

I'll probably just wipe the server and start over

@palmeraeasd palmeraeasd mentioned this issue Mar 1, 2022
2 tasks
@palmeraeasd
Copy link
Author

Issue was related to using assigned_to in the patch (https://snipe-it.readme.io/reference/hardware-partial-update) function instead of checking in (https://snipe-it.readme.io/reference/hardware-checkin) and checking out (https://snipe-it.readme.io/reference/hardware-checkout) assets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants