Closed gaurav-pachar closed 1 year ago
I think this matches my issue so commenting here
We are using this @shopify/shopify-api
in our NestJS application. After upgrading the library to v3.1.3
(from ^3.0.0
), while building, we are getting this error-
ERROR in ./node_modules/@mapbox/node-pre-gyp/lib/util/nw-pre-gyp/index.html 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> <!doctype html>
| <html>
| <head>
@ ./node_modules/@mapbox/node-pre-gyp/lib/ sync ^\.\/.*$ ./util/nw-pre-gyp/index.html
@ ./node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js 86:13-36 291:36-53
@ ./node_modules/sqlite3/lib/sqlite3-binding.js 1:15-46
@ ./node_modules/sqlite3/lib/sqlite3.js 2:16-47
@ ./node_modules/@shopify/shopify-api/dist/auth/session/storage/sqlite.js 5:40-58
@ ./node_modules/@shopify/shopify-api/dist/context.js 7:15-55
@ ./node_modules/@shopify/shopify-api/dist/index.js 5:16-36
@ ./apps/client-app/src/services/shopify/shopify-webhook-api.service.ts 16:22-53
@ ./apps/client-app/src/artifacts.module.ts 70:38-95
@ ./apps/client-app/src/app.module.ts 19:27-56
@ ./apps/client-app/src/main.ts 9:21-44
ERROR in ./node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js 43:20-42
Module not found: Error: Can't resolve 'mock-aws-s3' in '/Users/shashank/Projects/cooee/node-backend-app/node_modules/@mapbox/node-pre-gyp/lib/util'
@ ./node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js 15:21-62
@ ./node_modules/sqlite3/lib/sqlite3-binding.js 1:15-46
@ ./node_modules/sqlite3/lib/sqlite3.js 2:16-47
@ ./node_modules/@shopify/shopify-api/dist/auth/session/storage/sqlite.js 5:40-58
@ ./node_modules/@shopify/shopify-api/dist/context.js 7:15-55
@ ./node_modules/@shopify/shopify-api/dist/index.js 5:16-36
@ ./apps/client-app/src/services/shopify/shopify-webhook-api.service.ts 16:22-53
@ ./apps/client-app/src/artifacts.module.ts 70:38-95
@ ./apps/client-app/src/app.module.ts 19:27-56
@ ./apps/client-app/src/main.ts 9:21-44
ERROR in ./node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js 76:14-32
Module not found: Error: Can't resolve 'aws-sdk' in '/Users/shashank/Projects/cooee/node-backend-app/node_modules/@mapbox/node-pre-gyp/lib/util'
@ ./node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js 15:21-62
@ ./node_modules/sqlite3/lib/sqlite3-binding.js 1:15-46
@ ./node_modules/sqlite3/lib/sqlite3.js 2:16-47
@ ./node_modules/@shopify/shopify-api/dist/auth/session/storage/sqlite.js 5:40-58
@ ./node_modules/@shopify/shopify-api/dist/context.js 7:15-55
@ ./node_modules/@shopify/shopify-api/dist/index.js 5:16-36
@ ./apps/client-app/src/services/shopify/shopify-webhook-api.service.ts 16:22-53
@ ./apps/client-app/src/artifacts.module.ts 70:38-95
@ ./apps/client-app/src/app.module.ts 19:27-56
@ ./apps/client-app/src/main.ts 9:21-44
ERROR in ./node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js 112:15-30
Module not found: Error: Can't resolve 'nock' in '/Users/shashank/Projects/cooee/node-backend-app/node_modules/@mapbox/node-pre-gyp/lib/util'
@ ./node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js 15:21-62
@ ./node_modules/sqlite3/lib/sqlite3-binding.js 1:15-46
@ ./node_modules/sqlite3/lib/sqlite3.js 2:16-47
@ ./node_modules/@shopify/shopify-api/dist/auth/session/storage/sqlite.js 5:40-58
@ ./node_modules/@shopify/shopify-api/dist/context.js 7:15-55
@ ./node_modules/@shopify/shopify-api/dist/index.js 5:16-36
@ ./apps/client-app/src/services/shopify/shopify-webhook-api.service.ts 16:22-53
@ ./apps/client-app/src/artifacts.module.ts 70:38-95
@ ./apps/client-app/src/app.module.ts 19:27-56
@ ./apps/client-app/src/main.ts 9:21-44
ERROR in ./node_modules/node-gyp/lib/Find-VisualStudio.cs 9:6
Module parse failed: Unexpected token (9:6)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| // This script needs to be compatible with PowerShell v2 to run on Windows 2008R2 and Windows 7.
|
> using System;
| using System.Text;
| using System.Runtime.InteropServices;
@ ./node_modules/node-gyp/lib/ sync ^\.\/.*$ ./Find-VisualStudio.cs
@ ./node_modules/node-gyp/lib/node-gyp.js 41:13-36 191:36-53
@ ./node_modules/@mapbox/node-pre-gyp/lib/util/compile.js 31:26-53
@ ./node_modules/@mapbox/node-pre-gyp/lib/ sync ^\.\/.*$ ./util/compile.js ./util/compile
@ ./node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js 86:13-36 291:36-53
@ ./node_modules/sqlite3/lib/sqlite3-binding.js 1:15-46
@ ./node_modules/sqlite3/lib/sqlite3.js 2:16-47
@ ./node_modules/@shopify/shopify-api/dist/auth/session/storage/sqlite.js 5:40-58
@ ./node_modules/@shopify/shopify-api/dist/context.js 7:15-55
@ ./node_modules/@shopify/shopify-api/dist/index.js 5:16-36
@ ./apps/client-app/src/services/shopify/shopify-webhook-api.service.ts 16:22-53
@ ./apps/client-app/src/artifacts.module.ts 70:38-95
@ ./apps/client-app/src/app.module.ts 19:27-56
@ ./apps/client-app/src/main.ts 9:21-44
ERROR in ./node_modules/pg/lib/native/client.js 4:13-33
Module not found: Error: Can't resolve 'pg-native' in '/Users/shashank/Projects/cooee/node-backend-app/node_modules/pg/lib/native'
@ ./node_modules/pg/lib/native/index.js 2:0-36
@ ./node_modules/pg/lib/index.js 29:26-45 40:24-43
@ ./node_modules/@shopify/shopify-api/dist/auth/session/storage/postgresql.js 5:35-48
@ ./node_modules/@shopify/shopify-api/dist/auth/session/index.js 14:19-50
@ ./node_modules/@shopify/shopify-api/dist/index.js 8:40-65
@ ./apps/client-app/src/services/shopify/shopify-webhook-api.service.ts 16:22-53
@ ./apps/client-app/src/artifacts.module.ts 70:38-95
@ ./apps/client-app/src/app.module.ts 19:27-56
@ ./apps/client-app/src/main.ts 9:21-44
4 errors have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.
webpack 5.72.1 compiled with 6 errors in 5971 ms
Tried a couple of solutions but didn't work.
System:
NodeJS : v16.13.1 npm : 8.1.2 OS : macOS
installing the 'sqlite3' package before installing this 'shopify-node-api', worked for me.
Anyone found a solution?
We have same problem with @shopify/shopify-api
Installing sqlite3
didn't help
全く同じ問題を抱えています。 lambdaにデプロイしたときに発生します。 @shopify/shopify-api を v4.0.0 に変更した後におきました。
{
"errorType": "Runtime.ImportModuleError",
"errorMessage": "Error: Cannot find module '/var/task/web/node_modules/sqlite3/lib/binding/napi-v6-linux-glibc-arm64/node_sqlite3.node'\nRequire stack:\n- /var/task/web/node_modules/sqlite3/lib/sqlite3-binding.js\n- /var/task/web/node_modules/sqlite3/lib/sqlite3.js",
"stack": [
"Runtime.ImportModuleError: Error: Cannot find module '/var/task/web/node_modules/sqlite3/lib/binding/napi-v6-linux-glibc-arm64/node_sqlite3.node'",
"Require stack:",
"- /var/task/web/node_modules/sqlite3/lib/sqlite3-binding.js",
"- /var/task/web/node_modules/sqlite3/lib/sqlite3.js",
" at _loadUserApp (file:///var/runtime/index.mjs:726:17)",
" at async Object.module.exports.load (file:///var/runtime/index.mjs:741:21)",
" at async file:///var/runtime/index.mjs:781:15",
" at async file:///var/runtime/index.mjs:4:1"
]
}
I have the exact same problem.
Occurs when deploying to lambda.
It happened after changing @shopify/shopify-api
to v4.0.0.
I also just have same problem with sqlite in my docker container
I got this first
Error: Error relocating /node_modules/sqlite3/lib/binding/napi-v6-linux-musl-x64/node_sqlite3.node: _ZSt28__throw_bad_array_new_lengthv: symbol not found
and also this
Cannot find module '/node_modules/sqlite3/lib/binding/napi-v6-linux-musl-x64/node_sqlite3.node'
Having the same problem deploying to AWS AppRunner.
For me a temporary fix was to fix the Shopify API to version 3.0.0 in my package.json:
"@shopify/shopify-api": "3.0.0"
Hope this helps anyone.
Looks related to #410
Also getting the same issue.
I can run yarn install
successfully up till v3.0.1
but updating to v3.1.0
breaks.
error /node_modules/sqlite3: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build
I also get the same issue. Hope it's resolved soon
...
Any update here? This has become blocker for upgrade.
same here :(
I can't believe any library would use SQLite as a dependency...
@BarrickH v6 which was released recently has now removed the session storage interfaces from the lib. https://github.com/Shopify/shopify-api-js/blob/main/docs/migrating-to-v6.md#changes-to-session-and-sessionstorage
@lukeclifton v6 didn't resolve the SQLite issue. See https://github.com/Shopify/shopify-api-js/issues/410
@lukeclifton Thanks for the advice. Migrate to V6 and the shopify.auth.begin function for OAuth got totally broken in my app ; ) ...
[shopify-api/INFO] Beginning OAuth | {shop: stance.myshopify.com, isOnline: false, callbackPath: /app-auth/callback} [Nest] 66610 - 15/12/2022, 10:09:04 am ERROR [ExceptionsHandler] Missing adapter implementation for 'abstractConvertRequest' - make sure to import the appropriate adapter for your platform Error: Missing adapter implementation for 'abstractConvertRequest' - make sure to import the appropriate adapter for your platform at abstractConvertRequest (/Volumes/Development/backend_project/stance/dist/node_modules/@shopify/shopify-api/runtime/http/index.ts:34:9) at /Volumes/Development/backend_project/stance/dist/node_modules/@shopify/shopify-api/lib/auth/oauth/oauth.ts:57:49
@BarrickH Same. I had to run npm audit fix --force
because of some jsonwebtoken issue. It updated shopify-api to v6 and now I'm in a rabbit hole of migration issues.
Edit: Our issue doesn't seem to be related to sqlite.
Edit 2: After digging through their source code, I figured out that we just need to do import '@shopify/shopify-api/adapters/node'
before import ... from '@shopify/shopify-api'
. Then saw that it was in this guide after all
Hi folks, sorry for the delay in responding to this issue. We've been listening to the points raised here and we fixed the issue with sqlite in v6+ by removing all storage options as dependencies.
We're still supporting the same options as before with the packages in https://github.com/Shopify/shopify-app-js, but you'll have to import them individually (or create your own) and call them when you need to store / load sessions.
As for the last issue pointed out, the fix is indeed to call this before calling shopifyApi
import '@shopify/shopify-api/adapters/node'
This is necessary because this library now works with any JS runtime (like Cloudflare workers, for example), so apps need to specify which runtime to load.
To prevent others coming in from having the same issue, I'll improve the guide to make this very important change more visible.
Since the original problem with sqlite no longer applies, I'll close this issue. Please do open new issues if you still have any problems.
Issue summary
unable to install shopify-api with, npm i @shopify/shopify-api
Expected behavior
dependency should get installed
Actual behavior
while executing npm i @shopify/shopify-api, the process gets interrupted at
reify:@shopify/shopify-api: timing reifyNode:node_modules/@redis/client Completed in 361ms
the whole error log after interruption is:
this error does not occur if I create a boilerplate project using
shopify app create node
with shopify CLISteps to reproduce the problem
device: Macbook air M1 OS: MacOS Monterey(version 12.4) Node Version: 18.2.0 npm version: 8.9.0