@mikarinneoracle/oci-cdk-code-only-preview 0.0.22 → 0.0.23

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
@@ -124,14 +124,14 @@ export OCI_FUNCTION_HANDLER='func.handler'
124
124
  npx ocdk deploy --auto-approve --code-only
125
125
  ```
126
126
 
127
- For a Node.js function, use the Node launch command as the handler (not `fdk.handle`):
127
+ For a Node.js function, use the JavaScript file as the handler (not `fdk.handle` or `node func.js`):
128
128
 
129
129
  ```bash
130
130
  export OCI_CODE_ONLY_RUNTIME_NAME='node24.ol9'
131
- export OCI_FUNCTION_HANDLER='node func.js'
131
+ export OCI_FUNCTION_HANDLER='func.js'
132
132
  ```
133
133
 
134
- The equivalent `func.yaml` configuration is supported too, so the handler environment variable is unnecessary when this file contains `entrypoint: node func.js`:
134
+ The equivalent conventional `func.yaml` configuration is supported too. OCDK converts `entrypoint: node func.js` to the required code-only handler `func.js`:
135
135
 
136
136
  ```yaml
137
137
  schema_version: 20180708
@@ -54,8 +54,13 @@ function readFunctionMetadata() {
54
54
  const yaml = fs.existsSync(funcYamlPath) ? fs.readFileSync(funcYamlPath, 'utf8') : '';
55
55
  const functionName = (process.env.OCI_FUNCTION_NAME || yamlValue(yaml, 'name')).trim();
56
56
  const appName = (process.env.OCI_FUNCTION_APP_NAME || functionName).trim();
57
- const handler = (process.env.OCI_FUNCTION_HANDLER || yamlValue(yaml, 'cmd') || yamlValue(yaml, 'entrypoint')).trim();
58
57
  const runtimeName = (process.env.OCI_CODE_ONLY_RUNTIME_NAME || '').trim();
58
+ const configuredHandler = (process.env.OCI_FUNCTION_HANDLER || yamlValue(yaml, 'cmd') || yamlValue(yaml, 'entrypoint')).trim();
59
+ // The managed Node runtime already invokes `node`; its handler is the script
60
+ // path, whereas a conventional func.yaml entrypoint is `node func.js`.
61
+ const handler = runtimeName.toLowerCase().startsWith('node')
62
+ ? configuredHandler.replace(/^node\s+/, '')
63
+ : configuredHandler;
59
64
  const memory = integerValue(process.env.OCI_FUNCTION_MEMORY_MB || yamlValue(yaml, 'memory'), 'OCI_FUNCTION_MEMORY_MB', 256);
60
65
  const timeout = integerValue(process.env.OCI_FUNCTION_TIMEOUT_SECONDS || yamlValue(yaml, 'timeout'), 'OCI_FUNCTION_TIMEOUT_SECONDS', 30);
61
66
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikarinneoracle/oci-cdk-code-only-preview",
3
- "version": "0.0.22",
3
+ "version": "0.0.23",
4
4
  "description": "OCI CDK stack for OCI Functions, API Gateway, and related infrastructure",
5
5
  "main": "lib/index.js",
6
6
  "bin": {