@friggframework/core 2.0.0--canary.461.c5013fd.0 → 2.0.0--canary.461.176b582.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -154,35 +154,38 @@ async function checkDatabaseState(dbType) {
154
154
  }
155
155
 
156
156
  /**
157
- * Get Prisma binary path for Lambda environment
158
- * Checks multiple locations in priority order:
159
- * 1. Function's bundled Prisma (/var/task/node_modules/.bin/prisma) - for standalone functions
160
- * 2. Layer's Prisma (/opt/nodejs/node_modules/.bin/prisma) - for functions using Prisma layer with CLI
161
- * 3. Fallback to npx for local development
157
+ * Gets the path to the Prisma CLI entry point
158
+ *
159
+ * IMPORTANT: We invoke prisma/build/index.js directly instead of .bin/prisma
160
+ * because .bin/prisma uses __dirname to find WASM files, and when the symlink
161
+ * is resolved during Lambda packaging, __dirname points to .bin/ instead of
162
+ * prisma/build/, causing WASM files to not be found.
163
+ *
164
+ * @returns {string} Command to run Prisma CLI (e.g., 'node /path/to/index.js' or 'npx prisma')
162
165
  */
163
166
  function getPrismaBinaryPath() {
164
167
  const fs = require('fs');
165
- const isLambdaEnvironment = !!process.env.AWS_LAMBDA_FUNCTION_NAME || !!process.env.LAMBDA_TASK_ROOT;
166
-
167
- if (!isLambdaEnvironment) {
168
- return 'npx';
169
- }
170
-
171
- // Check function's own node_modules first (standalone dbMigrate)
172
- const functionPrisma = '/var/task/node_modules/.bin/prisma';
168
+
169
+ // Check function's bundled Prisma (Lambda) - use actual CLI location
170
+ const functionPrisma = '/var/task/node_modules/prisma/build/index.js';
173
171
  if (fs.existsSync(functionPrisma)) {
174
- return functionPrisma;
172
+ return `node ${functionPrisma}`;
175
173
  }
176
174
 
177
- // Fall back to layer path (functions using Prisma layer with CLI)
178
- const layerPrisma = '/opt/nodejs/node_modules/.bin/prisma';
175
+ // Check Lambda layer path - use actual CLI location
176
+ const layerPrisma = '/opt/nodejs/node_modules/prisma/build/index.js';
179
177
  if (fs.existsSync(layerPrisma)) {
180
- return layerPrisma;
178
+ return `node ${layerPrisma}`;
181
179
  }
182
180
 
183
- // Should not reach here in Lambda, but provide fallback
184
- console.warn('⚠️ Prisma binary not found in expected Lambda paths, using npx');
185
- return 'npx';
181
+ // Check local node_modules - use actual CLI location
182
+ const localPrisma = path.join(process.cwd(), 'node_modules', 'prisma', 'build', 'index.js');
183
+ if (fs.existsSync(localPrisma)) {
184
+ return `node ${localPrisma}`;
185
+ }
186
+
187
+ // Fallback to npx (local dev)
188
+ return 'npx prisma';
186
189
  }
187
190
 
188
191
  /**
@@ -215,7 +218,11 @@ async function runPrismaMigrate(command = 'dev', verbose = false) {
215
218
  console.log(chalk.gray(`Running: ${displayCmd}`));
216
219
  }
217
220
 
218
- const proc = spawn(prismaBin, args, {
221
+ // Execute the command (prismaBin might be 'node /path/to/index.js' or 'npx prisma')
222
+ const [executable, ...executableArgs] = prismaBin.split(' ');
223
+ const fullArgs = [...executableArgs, ...args];
224
+
225
+ const proc = spawn(executable, fullArgs, {
219
226
  stdio: 'inherit',
220
227
  env: {
221
228
  ...process.env,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@friggframework/core",
3
3
  "prettier": "@friggframework/prettier-config",
4
- "version": "2.0.0--canary.461.c5013fd.0",
4
+ "version": "2.0.0--canary.461.176b582.0",
5
5
  "dependencies": {
6
6
  "@aws-sdk/client-apigatewaymanagementapi": "^3.588.0",
7
7
  "@aws-sdk/client-kms": "^3.588.0",
@@ -37,9 +37,9 @@
37
37
  }
38
38
  },
39
39
  "devDependencies": {
40
- "@friggframework/eslint-config": "2.0.0--canary.461.c5013fd.0",
41
- "@friggframework/prettier-config": "2.0.0--canary.461.c5013fd.0",
42
- "@friggframework/test": "2.0.0--canary.461.c5013fd.0",
40
+ "@friggframework/eslint-config": "2.0.0--canary.461.176b582.0",
41
+ "@friggframework/prettier-config": "2.0.0--canary.461.176b582.0",
42
+ "@friggframework/test": "2.0.0--canary.461.176b582.0",
43
43
  "@prisma/client": "^6.17.0",
44
44
  "@types/lodash": "4.17.15",
45
45
  "@typescript-eslint/eslint-plugin": "^8.0.0",
@@ -79,5 +79,5 @@
79
79
  "publishConfig": {
80
80
  "access": "public"
81
81
  },
82
- "gitHead": "c5013fd783f4caff2bff644d36d65e434483a79a"
82
+ "gitHead": "176b5825613b18d39abb44b9428291a446a798e5"
83
83
  }