redochka / nextjs-shopify-app-no-custom-server Goto Github PK
View Code? Open in Web Editor NEWShopify app using NextJS. No custom NextJS server needed.
License: MIT License
Shopify app using NextJS. No custom NextJS server needed.
License: MIT License
On a local env, it runs into trouble when it tries to fetch products. It appears that it's not able to get an online session
event - compiled client and server successfully in 438 ms (1421 modules)
error - (api)/pages/api/products.js (10:53) @ __WEBPACK_DEFAULT_EXPORT__
TypeError: Cannot read properties of undefined (reading 'shop')
8 |
9 | const session = await Shopify.Utils.loadCurrentSession(req, res);
> 10 | const client = new Shopify.Clients.Graphql(session.shop, session.accessToken);
The redirects work great on desktop, but on mobile it tries to take you to the app instead of the install page, which results in a "page not found" error on Shopify.
I can’t figure out what the issue is that it doesn’t want to redirect properly on mobile. Any ideas?
just to clarify, this is the redirect that happens when clicking "add app" from the listing page.
Greetings,
I am currently modifying this on a fork. I got an error when trying to access your sample page.
nextjs-shopify-app-base-nextjs-1 | error - (api)/pages/api/products.js (10:53) @ WEBPACK_DEFAULT_EXPORT
TypeError: Cannot read properties of undefined (reading 'shop')
nextjs-shopify-app-base-nextjs-1 | 8 |
nextjs-shopify-app-base-nextjs-1 | 9 | const session = await Shopify.Utils.loadCurrentSession(req, res, true);
nextjs-shopify-app-base-nextjs-1 | > 10 | const client = new Shopify.Clients.Graphql(session.shop, session.accessToken);
nextjs-shopify-app-base-nextjs-1 | | ^
nextjs-shopify-app-base-nextjs-1 | 11 | // Use client.get
to request the specified Shopify GraphQL API endpoint, in this case products
.
nextjs-shopify-app-base-nextjs-1 | 12 | const products = await client.query({
nextjs-shopify-app-base-nextjs-1 | 13 | data: `{
nextjs-shopify-app-base-nextjs-1 | wait - compiling /_error (client and server)...
Redis is working correctly (seemingly), and it says there is one key in the database after installation.
nextjs-shopify-app-base-nextjs-1 | token record from redis: {
nextjs-shopify-app-base-nextjs-1 | id: 'offline_REDACTED-development.myshopify.com',
nextjs-shopify-app-base-nextjs-1 | shop: 'REDACTED-development.myshopify.com',
nextjs-shopify-app-base-nextjs-1 | state: '628137656797721',
nextjs-shopify-app-base-nextjs-1 | isOnline: false,
nextjs-shopify-app-base-nextjs-1 | accessToken: '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',
nextjs-shopify-app-base-nextjs-1 | scope: 'write_products,write_customers,write_draft_orders,write_files'
nextjs-shopify-app-base-nextjs-1 | }
Do you have any idea what could be the problem? I changed the Redis loglevel to "Debug" and it does affirm one key in the database. I used the CLI to retrieve it and it looks okay ( i guess)
I am both new to Shopify aswell as Redis. My other sample app just used the InMemory storage, but since your project depends on having Redis, I am bumping into this issue. If you have any idea what could be the issue here I would be very thankful
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.