koa-shopify-auth icon indicating copy to clipboard operation
koa-shopify-auth copied to clipboard

error in my custom session after updating to 5.0.3

Open ironda2020 opened this issue 2 years ago • 13 comments

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 avatar Feb 28 '22 22:02 ironda2020

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 avatar Feb 28 '22 22:02 ironda2020

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?

ironda2020 avatar Feb 28 '22 22:02 ironda2020

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

assaflei avatar Mar 03 '22 00:03 assaflei

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.

avocadoslab avatar Mar 03 '22 14:03 avocadoslab

@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.

Asadmasood195 avatar Mar 03 '22 18:03 Asadmasood195

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

ironda2020 avatar Mar 03 '22 19:03 ironda2020

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

image

avocadoslab avatar Mar 04 '22 01:03 avocadoslab

Yes exactly @pratiknikam

ironda2020 avatar Mar 06 '22 19:03 ironda2020

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.

technologytesting avatar Mar 08 '22 14:03 technologytesting

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

zloz avatar Mar 15 '22 14:03 zloz

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], });

technologytesting avatar Mar 15 '22 14:03 technologytesting

Hi does anyone have any news on this problem?

ironda2020 avatar Mar 21 '22 09:03 ironda2020

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

PurplePineapple123 avatar Apr 04 '22 17:04 PurplePineapple123

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.

github-actions[bot] avatar Jan 30 '23 20:01 github-actions[bot]