Shopify / shopify-app-template-node

MIT License
860 stars 393 forks source link

Loading REST resources for API version undefined, which doesn't match the default 2023-04 #1275

Closed kfwebdev closed 1 year ago

kfwebdev commented 1 year ago

Issue summary

Shopify-api load-rest-resources breaks when trying to load rest-resources.

resources[firstResource].API_VERSION is undefined

Error is thrown here:

    if (config.apiVersion !== resources[firstResource].API_VERSION) {
        (0, logger_1.logger)(config).warning(`Loading REST resources for API version ${resources[firstResource].API_VERSION}, which doesn't match the default ${config.apiVersion}`);
    }
2023-06-05 05:30:38 | backend    | [shopify-api/WARNING] Loading REST resources for API version undefined, which doesn't match the default 2023-04
2023-06-05 05:30:38 | backend    | C:\web\projects\shopify-video-player\web\node_modules\@shopify\shopify-app-express\node_modules\@shopify\shopify-api\rest\load-rest-resources.js:17
2023-06-05 05:30:38 | backend    |         Object.entries(NewResource.HAS_ONE).map(([_attribute, klass]) => {
2023-06-05 05:30:38 | backend    |                ^
2023-06-05 05:30:38 | backend    |
2023-06-05 05:30:38 | backend    | TypeError: Cannot convert undefined or null to object
2023-06-05 05:30:38 | backend    |     at Function.entries (<anonymous>)
2023-06-05 05:30:38 | backend    |     at C:\web\projects\shopify-video-player\web\node_modules\@shopify\shopify-app-express\node_modules\@shopify\shopify-api\rest\load-rest-resources.js:17:16
2023-06-05 05:30:38 | backend    |     at Array.map (<anonymous>)
2023-06-05 05:30:38 | backend    |     at loadRestResources (C:\web\projects\shopify-video-player\web\node_modules\@shopify\shopify-app-express\node_modules\@shopify\shopify-api\rest\load-rest-resources.js:10:57)
2023-06-05 05:30:38 | backend    |     at Object.shopifyApi (C:\web\projects\shopify-video-player\web\node_modules\@shopify\shopify-app-express\node_modules\@shopify\shopify-api\lib\index.js:43:68)
2023-06-05 05:30:38 | backend    |     at shopifyApp (C:\web\projects\shopify-video-player\web\node_modules\@shopify\shopify-app-express\build\cjs\index.js:26:26)
2023-06-05 05:30:38 | backend    |     at file:///C:/web/projects/shopify-video-player/web/shopify.js:19:17
2023-06-05 05:30:38 | backend    |     at ModuleJob.run (node:internal/modules/esm/module_job:194:25)
2023-06-05 05:30:38 | backend    |
2023-06-05 05:30:38 | backend    | Node.js v18.13.0
2023-06-05 05:30:38 | backend    | [nodemon] app crashed - waiting for file changes before starting...

Expected behavior

Error should not occur.

Actual behavior

Error occurs.

Steps to reproduce the problem

  1. Run npm run dev
kfwebdev commented 1 year ago

Issue was resolved by fixing the @shopify/shopify-app-express version from "^1.1.0" to "^2.1.1"