-
Notifications
You must be signed in to change notification settings - Fork 366
Update Function Docs to reflect new UI #558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
||
- **Callback Return** - This shows what data the function returned, or the error it threw. | ||
- **Log Output** - The raw log. Any messages to `console.log()` from the function appear here. | ||
|
||
## Creation & Deployment | ||
|
||
Once you're satisfied with your Destination Function, you can deploy your code by clicking the `Configure` button on the bottom right of the editor. This brings you to a screen to name your function and optionally add additional details that will be displayed in your workspace. Hit `Create Function` and your Destination Function will be ready to be used within your workspace. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once you're satisfied with your Destination Function, you can deploy your code by clicking the
Configure button on the bottom right of the editor.
- that's not accurate. When you create a destination function, you don't deploy it, you only create a class in the catalog. Then, users need to connect destinations to sources, which will deploy an instance. @chriso is this correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made some updates here but would need clarification from @chriso on the piece when I'm editing a function and click Save & Deploy - what's the status. My understanding was even at that point, we're not deploying to instances so actually the button shouldn't say Save & Deploy
technically speaking, right? cc: @vadimdemedes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Destination function instances all use code from the class, so if you save your function, you're implicitly "deploying" it.
With source functions, the save and deploy steps are two separate things. Updating the class doesn't automatically update instances; you have to deploy changes to them.
Co-Authored-By: Vadim Demedes <[email protected]>
Co-Authored-By: Vadim Demedes <[email protected]>
Co-Authored-By: Vadim Demedes <[email protected]>
Co-Authored-By: Vadim Demedes <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh sorry these comments got stuck in "review limbo"
The JavaScript below builds a query string for the URL, sets a basic auth header, and sends a JSON body. | ||
|
||
```js | ||
const endpoint = "https://REDACTED.x.example.com" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use single quotes here and in the rest of examples for consistency.
|
||
```js | ||
async function onGroup(event, settings) { | ||
if (!event.company) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no company
field on the group event (or any other event).
|
||
```js | ||
async function onRequest(request, settings) { | ||
let settingValue = settings.settingKey; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let settingValue = settings.settingKey; | |
// Retrieve value of a setting `settingKey` | |
const settingValue = settings.settingKey; |
You can access header data using the `request.headers` property and the [Headers](https://developer.mozilla.org/en-US/docs/Web/API/Headers) interface. For example:" | ||
|
||
```js | ||
async function onRequest(request, settings) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
async function onRequest(request, settings) { | |
function onRequest(request, settings) { |
|
||
```js | ||
async function onRequest(request, settings) { | ||
const requestHeader = request.headers.get('Content-Type') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const requestHeader = request.headers.get('Content-Type') | |
const contentType = request.headers.get('Content-Type') |
|
||
```js | ||
async function onRequest(request, settings) { | ||
const requestHeader = request.headers.get('Content-Type') | ||
let settingValue = settings.settingKey; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let settingValue = settings.settingKey; | |
// Retrieve value of a setting "settingKey" | |
const settingValue = settings.settingKey; |
Co-Authored-By: Vadim Demedes <[email protected]>
Co-Authored-By: Vadim Demedes <[email protected]>
Co-Authored-By: Vadim Demedes <[email protected]>
Co-Authored-By: Vadim Demedes <[email protected]>
Proposed changes
To Do
Related issues (optional)
Closes https://segment.atlassian.net/browse/FUN-460