Shopify / shopify-app-bridge

https://shopify.dev/docs/api/app-bridge
88 stars 9 forks source link

Unable to access the API directly, as described here: https://shopify.dev/docs/api/app-bridge-library#direct-api-access. #283

Closed mailofeli closed 9 months ago

mailofeli commented 9 months ago

Describe the bug

I'm trying to access the API directly, as described here: https://shopify.dev/docs/api/app-bridge-library#direct-api-access.

Getting "Fetch API cannot load shopify:admin/api/graphql.json. URL scheme "shopify" is not supported."

To Reproduce

Steps to reproduce the behaviour:

I've added this to my TOML file:

[access.admin] direct_api_mode = "online" embedded_app_direct_api_access = true

I'm running the following basic fetch request:

const res = await fetch('shopify:admin/api/graphql.json', { method: 'POST', body: JSON.stringify({ query: query GetProduct($id: ID!) { product(id: $id) { title } } , variables: {id: 'gid://shopify/Product/8344298258728'}, }), });

Expected behaviour

A JSON representation of the product should be returned.

Contextual information

Packages and versions

List the relevant packages you’re using, and their versions. For example:

Platform

Additional context

Add any other context about the problem here, such as your app’s configuration (Node, Next.js, Rails).

daviareias commented 6 months ago

How did you mange to solve this? I only get a network error

mschristianjohansson commented 6 months ago

Same issue here with latest version or everything