Answers.Body: <p>This is a bug in Commerce that has been fixed via <a href="https://github.com/craftcms/commerce/commit/b3ec7bb0d21f461df7a3297fbc74c295a5e1fc82" rel="nofollow noreferrer">https://github.com/craftcms/commerce/commit/b3ec7bb0d21f461df7a3297fbc74c295a5e1fc82</a> and will be included in the next Commerce 3 and 4 releases.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-01-09T18:55:25.820Z
Answers.LastActivityDate: 2023-01-09T18:55:25.820Z
Answers.UserDisplayName: Brad Bell
Body: <p>Whenever I run a feed via the Direct link eg. <a href="https://site.com/index.php?p=actions/feed-me/feeds/run-task&amp;direct=1&amp;feedId=%5Bid%5D&amp;passkey=%5Bpasskey%5D" rel="nofollow noreferrer">https://site.com/index.php?p=actions/feed-me/feeds/run-task&amp;direct=1&amp;feedId=[id]&amp;passkey=[passkey]</a> when I'm logged out of the CP.</p>
  <p>I get the following error:</p>
  <pre><code>craft\commerce\services\ProductTypes::hasPermission(): Argument #1 ($user) must be of type craft\elements\User, null given, called in /public_html/vendor/craftcms/commerce/src/services/ProductTypes.php on line 178
  </code></pre>
  <p>When logged in, it works fine</p>
  <p><strong>Steps to reproduce</strong></p>
  <p>Log out of CP
  Run a feed via the Direct link</p>
  
Tags: <plugin-craftcommerce><plugin-feedme>
Title: Feed me plugin craft\commerce\services\ProductTypes::hasPermission(): Argument #1 ($user) must be of type craft\elements\User
ThreadText: # Feed me plugin craft\commerce\services\ProductTypes::hasPermission(): Argument #1 ($user) must be of type craft\elements\User
  
  (Asked by: username_0 on 2022-12-31)
  
  Whenever I run a feed via the Direct link eg. [https://site.com/index.php?p=actions/feed-me/feeds/run-task&direct=1&feedId=[id]&passkey=[passkey]](https://site.com/index.php?p=actions/feed-me/feeds/run-task&direct=1&feedId=%5Bid%5D&passkey=%5Bpasskey%5D) when I'm logged out of the CP.
  
  I get the following error:
  
  ```
  craft\commerce\services\ProductTypes::hasPermission(): Argument #1 ($user) must be of type craft\elements\User, null given, called in /public_html/vendor/craftcms/commerce/src/services/ProductTypes.php on line 178
  
  ```
  
  When logged in, it works fine
  
  **Steps to reproduce**
  
  Log out of CP
  Run a feed via the Direct link
  
  **Tags:** plugin-craftcommerce, plugin-feedme
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-01-09. Score: 2 | Accepted answer
  
  This is a bug in Commerce that has been fixed via <https://github.com/craftcms/commerce/commit/b3ec7bb0d21f461df7a3297fbc74c295a5e1fc82> and will be included in the next Commerce 3 and 4 releases.
  
  
  ---
  
  