@mikarinneoracle/oci-cdk-code-only-preview 0.0.31 → 0.0.32

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.
package/README.md CHANGED
@@ -184,7 +184,7 @@ export OCI_FUNCTION_APP_NAME='my-existing-function-app'
184
184
 
185
185
  These settings are optional: `OCI_CODE_ONLY_SOURCE_DIR` (defaults to the current directory), `OCI_FUNCTION_MEMORY_MB` (from `func.yaml`, otherwise `256`), and `OCI_FUNCTION_TIMEOUT_SECONDS` (from `func.yaml`, otherwise `30`). `OCI_TENANCY_ID`, `OCI_REGION`, and `OCI_NAMESPACE` are also optional when they can be resolved from the active OCI CLI profile.
186
186
 
187
- Each deploy re-builds `<function-name>.zip` in the project root and uploads that file. The ZIP has the required `function/` directory at its root, includes source files, and excludes `node_modules`, `package-lock.json`, `.git`, `.tools`, `.terraform`, `cdktf.out`, and the generated `.ocdk/` directory. For Node.js functions, a sanitized `package.json` remains so OCI can install the FDK and other dependencies; OCDK removes its own package dependency (`@mikarinneoracle/oci-cdk-code-only-preview`, and the legacy package name) from that copied manifest. For Python and Java code-only functions, `package.json` is excluded entirely. A successful code-only destroy removes this ZIP after Terraform has destroyed the Function App and infrastructure. With the default `OCI_STACK_ACTION=full-stack`, OCDK creates the API Gateway and uses a Terraform data source to resolve the CLI-managed function OCID for its route. The first code-only deploy therefore runs Terraform once to create the Function App, uploads the function, then runs Terraform again to create the Gateway deployment. Set `OCI_STACK_ACTION=function-only` to omit API Gateway.
187
+ Each deploy re-builds `<function-name>.zip` in the project root and uploads that file. For Python and Node.js, source files are at the ZIP root because OCI extracts the archive into `/function`; this makes a standard Python entrypoint such as `/python/bin/fdk /function/func.py handler` resolve correctly. The archive excludes `node_modules`, `package-lock.json`, `.git`, `.tools`, `.terraform`, `cdktf.out`, and the generated `.ocdk/` directory. For Node.js functions, a sanitized `package.json` remains so OCI can install the FDK and other dependencies; OCDK removes its own package dependency (`@mikarinneoracle/oci-cdk-code-only-preview`, and the legacy package name) from that copied manifest. For Python and Java code-only functions, `package.json` is excluded entirely. A successful code-only destroy removes this ZIP after Terraform has destroyed the Function App and infrastructure. With the default `OCI_STACK_ACTION=full-stack`, OCDK creates the API Gateway and uses a Terraform data source to resolve the CLI-managed function OCID for its route. The first code-only deploy therefore runs Terraform once to create the Function App, uploads the function, then runs Terraform again to create the Gateway deployment. Set `OCI_STACK_ACTION=function-only` to omit API Gateway.
188
188
 
189
189
  After a successful code-only deploy, OCDK writes the log IDs for `npx ocdk tail:execution-log` automatically.
190
190
 
@@ -208,7 +208,11 @@ function createArchive(functionName, runtimeName) {
208
208
  }
209
209
  return { tempDir, archivePath };
210
210
  }
211
- const archiveRoot = path.join(tempDir, 'function');
211
+ // OCI extracts a source archive directly into /function. Do not add a
212
+ // "function/" wrapper directory here: a standard Fn Python entrypoint such
213
+ // as "/python/bin/fdk /function/func.py handler" must resolve func.py at
214
+ // the ZIP root after extraction.
215
+ const archiveRoot = tempDir;
212
216
  const excludedTopLevel = new Set(['node_modules', '.git', '.tools', '.terraform', 'cdktf.out', '.ocdk', 'tail-function-logs.js', 'package-lock.json']);
213
217
  if (!isNodeRuntime) excludedTopLevel.add('package.json');
214
218
  fs.cpSync(projectDir, archiveRoot, {
@@ -222,7 +226,7 @@ function createArchive(functionName, runtimeName) {
222
226
  });
223
227
  if (isNodeRuntime) preparePackageManifest(archiveRoot);
224
228
  fs.rmSync(archivePath, { force: true });
225
- const zip = spawnSync('zip', ['-q', '-r', archivePath, 'function'], { cwd: tempDir, encoding: 'utf8', shell: false });
229
+ const zip = spawnSync('zip', ['-q', '-r', archivePath, '.'], { cwd: tempDir, encoding: 'utf8', shell: false });
226
230
  if (zip.error || zip.status !== 0) {
227
231
  fs.rmSync(tempDir, { recursive: true, force: true });
228
232
  fs.rmSync(archivePath, { force: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikarinneoracle/oci-cdk-code-only-preview",
3
- "version": "0.0.31",
3
+ "version": "0.0.32",
4
4
  "description": "OCI CDK stack for OCI Functions, API Gateway, and related infrastructure",
5
5
  "main": "lib/index.js",
6
6
  "bin": {