Shopify / koa-shopify-auth

DEPRECATED Middleware to authenticate a Koa application with Shopify
MIT License
80 stars 63 forks source link

error in my custom session after updating to 5.0.3 #153

Closed ironda2020 closed 1 year ago

ironda2020 commented 2 years ago

Issue summary

after updating koa-shopify-auth from 4.1.4 to 5.0.3 my custom session does not work anymore

Shopify.Context.initialize({ API_KEY: process.env.SHOPIFY_API_KEY, API_SECRET_KEY: process.env.SHOPIFY_API_SECRET, SCOPES: process.env.SHOPIFY_API_SCOPES.split(","), HOST_NAME: process.env.HOST.replace(/https:\/\/|\/$/g, ""), API_VERSION: process.env.API_VERSION, IS_EMBEDDED_APP: true, SESSION_STORAGE: new Shopify.Session.CustomSessionStorage( storeCallBack, loadCallBack, deleteCallBack ), });

Expected behavior

my custom session should still work fine

Actual behavior

I get this error:

InternalServerError: OAuth Session could not be deleted. Please check your session storage functionality. at Object.throw (C:\myApps\ir-app\node_modules\koa\lib\context.js:97:11) at C:\myApps\ir-app\node_modules\@shopify\koa-shopify-auth\dist\src\auth\index.js:107:42 at step (C:\myApps\ir-app\node_modules\tslib\tslib.js:141:27) at Object.throw (C:\myApps\ir-app\node_modules\tslib\tslib.js:122:57) at rejected (C:\myApps\ir-app\node_modules\tslib\tslib.js:113:69) at processTicksAndRejections (internal/process/task_queues.js:93:5)

Steps to reproduce the problem

  1. updating koa-shopify-auth from 4.1.4 to 5.0.3
ironda2020 commented 2 years ago

if i go back to 4.1.4 everything works fine but the shopify partner informs me that: My app is using an older version of either the shopify_app gem or @shopify/koa-shopify-auth library that has called the deprecated Embedded App SDK (EASDK) within the last 10 days. You must update this app to use either shopify_app [v18.1.1] (https://github.com/Shopify/shopify_app/blob/master/docs/Upgrading.md) or @shopify/koa-shopify-auth [v5.0.3](https://github.com/Shopify/koa-shopify-auth/blob/master/CHANGELOG.md). Updating will replace these EASDK calls with App Bridge.

ironda2020 commented 2 years ago

I think it's due to this change: [5.0.0] - 2022-02-24 :[breaking] Upgraded @shopify/shopify-api version see https://github.com/Shopify/koa-shopify-auth/blob/master/CHANGELOG.md Any ideas?

assaflei commented 2 years ago

I'm not getting the same exact error but on my implementation I saw that using Context on this line returns an empty string despite using the Shopify.Context.initialize command. It looks like the koa object uses a different context object...

Using shopify-api 2.1.0 koa-shopify-auth 5.0.3

avocadoslab commented 2 years ago

I'm constantly running into Invalid OAuth callback since I upgraded to 5.0.3 when I'm trying to install app locally on my development store.

Asadmasood195 commented 2 years ago

@ironda2020 I am also facing the same issue that you are mentioned above. Any solution you find out instead of switch back to previous 4.1.4 version. I have also find another issue is we need to use add handlers to register webhooks but in 4.1.4 was not required to addhandlers to register webhooks. Please help me.

ironda2020 commented 2 years ago

Hi @Asadmasood195 no solution for the moment! I returned back to 4.1.4 version while waiting for the people who made this update to give us a feedback. Thank you all

avocadoslab commented 2 years ago

I believe you see following warning in your partner dashboard but despite reverted to older version to stay operational.

image
ironda2020 commented 2 years ago

Yes exactly @pratiknikam

technologytesting commented 2 years ago

Same here. Switched to 5.0.3 & started having issues with the uninstall webhook as well as general oAuth process. I've reverted back to v4.1.2 for time being while I figure out how to be operational with 5.0.3.

zloz commented 2 years ago

Same wasted the whole day trying to debug, finally switching back to 4.1.5. If it helps anyone my nextjs version is 11.1.2 and webpack is 4.44.1

technologytesting commented 2 years ago

I was able to fix the uninstall webhook issue I was facing and currently am operational with 5.03. If you're having a webhook issue, make sure the below code is added above app.prepare() in server.jsShopify.Webhooks.Registry.addHandler("APP_UNINSTALLED", { path: "/webhooks", webhookHandler: async (topic, shop, body) => delete ACTIVE_SHOPIFY_SHOPS[shop], });

ironda2020 commented 2 years ago

Hi does anyone have any news on this problem?

PurplePineapple123 commented 2 years ago

Any updates? Running into the Invalid OAuth callback issue as well since updating to 5.0.3.

github-actions[bot] commented 1 year ago

Note that this repo is no longer maintained and this issue will not be reviewed. Prefer the official JavaScript API library. If you still want to use Koa, see simple-koa-shopify-auth for a potential community solution.