@mikarinneoracle/oci-cdk-code-only-preview 0.0.20 → 0.0.22
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 +22 -4
- package/bin/deploy-code-only.js +1 -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 Node launch command as the handler (not `fdk.handle`):
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
export OCI_CODE_ONLY_RUNTIME_NAME='node24.ol9'
|
|
131
|
+
export OCI_FUNCTION_HANDLER='node func.js'
|
|
132
|
+
```
|
|
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`:
|
|
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:
|
|
@@ -132,10 +150,10 @@ The exact `OCI_CODE_ONLY_RUNTIME_NAME` values are enabled per tenancy and region
|
|
|
132
150
|
# List every runtime available to the active OCI profile
|
|
133
151
|
"$OCI_CLI_PATH" fn runtime list --all --output table
|
|
134
152
|
|
|
135
|
-
# Narrow the list
|
|
136
|
-
"$OCI_CLI_PATH" fn runtime list --all --
|
|
137
|
-
"$OCI_CLI_PATH" fn runtime list --all --
|
|
138
|
-
"$OCI_CLI_PATH" fn runtime list --all --
|
|
153
|
+
# Narrow the list by runtime-name prefix, for example Python, Node.js, or Java
|
|
154
|
+
"$OCI_CLI_PATH" fn runtime list --all --name-starts-with python --output table
|
|
155
|
+
"$OCI_CLI_PATH" fn runtime list --all --name-starts-with node --output table
|
|
156
|
+
"$OCI_CLI_PATH" fn runtime list --all --name-starts-with java --output table
|
|
139
157
|
```
|
|
140
158
|
|
|
141
159
|
OCI Functions supports Java, Python, Node.js, Go, Ruby, and C# FDKs in general; code-only availability is limited to the runtimes returned by the command above. See Oracle's [supported language versions](https://docs.oracle.com/en-us/iaas/Content/Functions/Tasks/languagessupportedbyfunctions.htm).
|
package/bin/deploy-code-only.js
CHANGED
|
@@ -54,7 +54,7 @@ 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();
|
|
57
|
+
const handler = (process.env.OCI_FUNCTION_HANDLER || yamlValue(yaml, 'cmd') || yamlValue(yaml, 'entrypoint')).trim();
|
|
58
58
|
const runtimeName = (process.env.OCI_CODE_ONLY_RUNTIME_NAME || '').trim();
|
|
59
59
|
const memory = integerValue(process.env.OCI_FUNCTION_MEMORY_MB || yamlValue(yaml, 'memory'), 'OCI_FUNCTION_MEMORY_MB', 256);
|
|
60
60
|
const timeout = integerValue(process.env.OCI_FUNCTION_TIMEOUT_SECONDS || yamlValue(yaml, 'timeout'), 'OCI_FUNCTION_TIMEOUT_SECONDS', 30);
|