@mikarinneoracle/oci-cdk-code-only-preview 0.0.21 → 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 +18 -0
- package/bin/deploy-code-only.js +6 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -124,6 +124,24 @@ 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 JavaScript file as the handler (not `fdk.handle` or `node func.js`):
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
export OCI_CODE_ONLY_RUNTIME_NAME='node24.ol9'
|
|
131
|
+
export OCI_FUNCTION_HANDLER='func.js'
|
|
132
|
+
```
|
|
133
|
+
|
|
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
|
+
|
|
136
|
+
```yaml
|
|
137
|
+
schema_version: 20180708
|
|
138
|
+
name: my-node-function
|
|
139
|
+
runtime: node
|
|
140
|
+
entrypoint: node func.js
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Keep `@fnproject/fdk` in `package.json` dependencies. The function source file uses `fdk.handle(...)`; it is not the OCI handler value.
|
|
144
|
+
|
|
127
145
|
#### Find the available code-only runtimes
|
|
128
146
|
|
|
129
147
|
The exact `OCI_CODE_ONLY_RUNTIME_NAME` values are enabled per tenancy and region during this Limited Availability preview. Query the Preview CLI instead of copying a runtime name from another environment:
|
package/bin/deploy-code-only.js
CHANGED
|
@@ -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')).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
|
|