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

Getting error when using _patch method with allowedUpsert service option enabled. #163

Closed
GVanderLugt opened this issue Nov 20, 2021 · 2 comments

Comments

@GVanderLugt
Copy link

When using the _patch() service method that skips service level hooks I am getting an error from feathers-objection. The service has allowedUpsert enabled. If I don't use _patch and use the regular patch instead, it works fine.

The error is:

error TypeError: Cannot read property 'mergeAllowUpsert' of undefined
at Object._patch (/app/node_modules/feathers-objection/lib/index.js:882:74)

The service is configured like:

export default function (app: Application) {
  const options = {
    Model: OrderModel,
    paginate: app.get('paginate'),
    whitelist: ['$eager', '$joinEager'],
    allowedEager: '[user, items.[product, fulfillment_method], shipping_address]',
    allowedInsert: '[items, shipping_address]',
    allowedUpsert: 'shipping_address',
    eagerFilters: [
      {
        expression: 'user',
        filter: 'eagerSelects',
      },
      {
        expression: 'items.product',
        filter: 'eagerSelects',
      },
    ],
  };

  // Initialize our service with any options it requires
  app.use('/orders', new Orders(options, app));

  // Get our initialized service so that we can register hooks
  const service = app.service('orders');

  service.hooks(hooks);
}
@GVanderLugt
Copy link
Author

I jumped the gun a bit on creating this issue. I tried removing the allowedUpsert configuration and the issue persists, so it's not necessarily related to that.

@GVanderLugt
Copy link
Author

I realized I was a bit behind on versions for feathers-objection. After updating to the latest version I am no longer having this issue.

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

1 participant