question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

product query by slug returns only 1 asset

See original GitHub issue

Describe the bug When executing the product query with the slug argument, only a single Asset is returned.

To Reproduce Steps to reproduce the behavior:

  1. Set up a Product with multiple Assets
  2. Query it using { product(slug: "laptop") { assets { id } } }
  3. Only a single asset is returned.

Expected behavior Should return all assets. Querying by id behaves correctly.

Environment (please complete the following information):

  • @vendure/core version: 1.0.0-beta.7
  • Nodejs version: any
  • Database (mysql/postgres etc): any

Additional context Possibly introduced in commit 2ace0eb0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Izaydacommented, Apr 13, 2021

Checked, you are totally right, getOne() operates with entities, not rows. Sorry for thus bug!

0reactions
michaelbromleycommented, Apr 13, 2021

Hopefully I didn’t introduce a new bug - as far as i know the TypeORM getOne() method will automatically limit the results of the select to a single entity, even when the query might yield multiple results.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Products | HTTP API
Name of the Product. User-defined identifier used in a deep-link URL for the Product. It must be unique across a Project, but a...
Read more >
Custom Query and sorting issue
I have created a shortcode with a custom query and I'm using it on many pages. Basically, I'm displaying products by the current...
Read more >
JetEngine: Query Builder WC Product Query Type
WC Product Query type of Query Builder from the JetEngine plugin allows you to create a customizable product list that is safe to...
Read more >
Querying for content - Contentful Developer Documentation
Get multiple assets. Getting multiple assets is similar to getting multiple entries. The only real difference is that the methods are not generic...
Read more >
Linked entries and assets in Contentful | Contentful
The one limitation of the Contentful Delivery API to bear in mind is that it will only return linked entries up to a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found