-
Notifications
You must be signed in to change notification settings - Fork 252
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
process is not defined
when importing Shopify Admin API in Hydrogen app
#977
Comments
Here we go, this remove the warning and you can access the adminApi, just remember to update the types. const shopify = shopifyApi({
apiKey: env.PRIVATE_API_KEY,
apiSecretKey: env.PRIVATE_API_SECRET_KEY,
adminApiAccessToken: env.PRIVATE_API_ACCESS_TOKEN,
apiVersion: LATEST_API_VERSION,
isCustomStoreApp: true,
scopes: [],
isEmbeddedApp: false,
hostName: env.PUBLIC_STORE_DOMAIN,
});
const shopifySession = shopify.session.customAppSession(
env.PUBLIC_STORE_DOMAIN,
);
const adminApi = new shopify.clients.Graphql({
session: shopifySession,
});
/**
* Create a Remix request handler and pass
* Hydrogen's Storefront client to the loader context.
*/
const handleRequest = createRequestHandler({
build: remixBuild,
mode: process.env.NODE_ENV,
getLoadContext: () => ({
session,
waitUntil,
storefront,
adminApi,
env,
}),
}); |
@jamalsoueidan, I still get the |
When deployed to Oxygen, Hydrogen is running in a worker environment, not Node, so you can't use standard node functionality. For example, export default {
async fetch(
request: Request,
env: Env, // here
executionContext: ExecutionContext,
): Promise<Response> { |
What is the location of your example repository?
No response
Which package or tool is having this issue?
Hydrogen
What version of that package or tool are you using?
2023-04
What version of Remix are you using?
1.15.0
Steps to Reproduce
.env
file generated by Hydrogen.@shopify/shopify-api
packageserver.ts
file.Then, initialize the Admin API, in the
fetch
function.Expected Behavior
Get access to the Admin API across the whole app through the context, just like it does with the Storefront API
Actual Behavior
I get this error instead:
The text was updated successfully, but these errors were encountered: