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

API error handling #3

Closed
michaelbromley opened this issue Mar 26, 2019 · 2 comments
Closed

API error handling #3

michaelbromley opened this issue Mar 26, 2019 · 2 comments

Comments

@michaelbromley
Copy link
Member

We need a mechanism for displaying and recovering from errors returned by the shop API. Currently the error is logged to the console and that's it.

Probably some kind of toast popup thing would work well. For critical errors (like no response from the API) maybe a different type of error display would be appropriate.

@cn2amz
Copy link

cn2amz commented May 29, 2019

gatsby develop error log:

E:\learning\gatsby\gatsby-storefront (master -> origin)
$ gatsby develop
success open and validate gatsby-configs - 0.056 s
success load plugins - 2.903 s
success onPreInit - 0.009 s
success initialize cache - 0.021 s
success copy gatsby files - 0.188 s
success onPreBootstrap - 0.031 s
success source and transform nodes - 2.493 s
success building schema - 0.436 s
success createPages - 0.694 s
success createPagesStatefully - 0.051 s
success onPreExtractQueries - 0.009 s
success update schema - 0.037 s
success extract queries from components - 0.214 s
success run static queries - 0.021 s — 2/2 124.75 queries/second
error
The GraphQL query from E:/learning/gatsby/gatsby-storefront/src/pages/index.tsx failed.

Errors:
column "si_enabled" does not exist

GraphQL request (3:5)
2: vendure {
3: search(input: {groupByProduct: true}) {
^
4: items {

URL path:
/
Context:
{}
Plugin:
none
Query:
query eLearningGatsbyGatsbyStorefrontSrcPagesIndexTsx2363505822 {
vendure {
search(input: {groupByProduct: true}) {
items {
productId
productName
description
slug
currencyCode
priceWithTax {
__typename
... on postgres_PriceRange {
min
max
}
... on postgres_SinglePrice {
value
}
}
productPreview
}
}
}
}

success run page queries - 1.640 s — 13/13 7.95 queries/second
success write out page data - 0.010 s
success write out redirect data - 0.003 s
success Build manifest and related icons - 0.176 s
success onPostBootstrap - 0.187 s

info bootstrap finished - 22.361 s

error
The GraphQL query from E:/learning/gatsby/gatsby-storefront/src/pages/index.tsx failed.

Errors:
column "si_enabled" does not exist

GraphQL request (3:5)
2: vendure {
3: search(input: {groupByProduct: true}) {
^
4: items {

URL path:
/
Context:
{}
Plugin:
none
Query:
query eLearningGatsbyGatsbyStorefrontSrcPagesIndexTsx2363505822 {
vendure {
search(input: {groupByProduct: true}) {
items {
productId
productName
description
slug
currencyCode
priceWithTax {
__typename
... on postgres_PriceRange {
min
max
}
... on postgres_SinglePrice {
value
}
}
productPreview
}
}
}
}

DONE Compiled successfully in 14153ms


You can now view gatsby-starter-default in the browser.

http://localhost:8000/

View GraphiQL, an in-browser IDE, to explore your site's data and schema

http://localhost:8000/___graphql

Note that the development build is not optimized.
To create a production build, use npm run build

info i 「wdm」:
info i 「wdm」: Compiled successfully.

==================================

root@ubuntu:/home/vendure/my-shop# npm run start

[email protected] start /home/vendure/my-shop
ts-node index.ts

info 5/29/19, 12:45 PM - [Vendure Server] Bootstrapping Vendure Server...
info 5/29/19, 12:46 PM - [NestApplication] Nest application successfully started
info 5/29/19, 12:46 PM - [Vendure Server] =================================================
info 5/29/19, 12:46 PM - [Vendure Server] Vendure server (v0.1.2-beta.2) now running on port 3000
info 5/29/19, 12:46 PM - [Vendure Server] Shop API: http://localhost:3000/shop-api
info 5/29/19, 12:46 PM - [Vendure Server] Admin API: http://localhost:3000/admin-api
info 5/29/19, 12:46 PM - [Vendure Server] Asset Server: http://localhost:3000/assets/ -> http://localhost:3001
info 5/29/19, 12:46 PM - [Vendure Server] Dev Mailbox: http://localhost:3000/mailbox/ -> http://localhost:3003
info 5/29/19, 12:46 PM - [Vendure Server] Admin UI: http://localhost:3000/admin/ -> http://localhost:3002
info 5/29/19, 12:46 PM - [Vendure Server] =================================================
error 5/29/19, 12:46 PM - [TypeORM] Query error: error: column "si_enabled" does not exist, "SELECT MIN("si"."sku") as "si_sku", bool_or("si"."enabled") as "si_enabled", MIN("si"."slug") as "si_slug", MIN("si"."price") as "si_price", MIN("si"."priceWithTax") as "si_priceWithTax", MIN("si"."productVariantId") as "si_productVariantId", MIN("si"."languageCode") as "si_languageCode", "si"."productId" as "si_productId", MIN("si"."productName") as "si_productName", MIN("si"."productVariantName") as "si_productVariantName", MIN("si"."description") as "si_description", string_agg("si"."facetIds", ',') as "si_facetIds", string_agg("si"."facetValueIds", ',') as "si_facetValueIds", string_agg("si"."collectionIds", ',') as "si_collectionIds", MIN("si"."productPreview") as "si_productPreview", MIN("si"."productVariantPreview") as "si_productVariantPreview", MIN(price) AS "minPrice", MAX(price) AS "maxPrice", MIN("priceWithTax") AS "minPriceWithTax", MAX("priceWithTax") AS "maxPriceWithTax" FROM "search_index_item" "si" WHERE 1 = 1 AND "si_enabled" = $1 GROUP BY "si"."productId" LIMIT 25" -- [true]
error 5/29/19, 12:46 PM - [TypeORM] Query error: error: column "si_enabled" does not exist, "SELECT MIN("si"."sku") as "si_sku", bool_or("si"."enabled") as "si_enabled", MIN("si"."slug") as "si_slug", MIN("si"."price") as "si_price", MIN("si"."priceWithTax") as "si_priceWithTax", MIN("si"."productVariantId") as "si_productVariantId", MIN("si"."languageCode") as "si_languageCode", "si"."productId" as "si_productId", MIN("si"."productName") as "si_productName", MIN("si"."productVariantName") as "si_productVariantName", MIN("si"."description") as "si_description", string_agg("si"."facetIds", ',') as "si_facetIds", string_agg("si"."facetValueIds", ',') as "si_facetValueIds", string_agg("si"."collectionIds", ',') as "si_collectionIds", MIN("si"."productPreview") as "si_productPreview", MIN("si"."productVariantPreview") as "si_productVariantPreview", MIN(price) AS "minPrice", MAX(price) AS "maxPrice", MIN("priceWithTax") AS "minPriceWithTax", MAX("priceWithTax") AS "maxPriceWithTax" FROM "search_index_item" "si" WHERE 1 = 1 AND "si_enabled" = $1 GROUP BY "si"."productId" LIMIT 25" -- [true]

@michaelbromley
Copy link
Member Author

Hi,

This looks like it is related to vendure-ecommerce/vendure#99, which is fixed and will be included in the next release (possibly next week). It is a postgres-specific bug so feel free to try another db engine for now.

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

2 participants