You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| recordEvent | [Event](#event) | `cwr('recordEvent', {type: 'your_event_type', data: {field1: 1, field2: 2}})` <br/><br/> `awsRum.recordEvent('your_event_type', {field1: 1, field2: 2})` | Record a custom event.<br/><br/>⚠️ The app monitor must have custom events enabled.<br/><br/> Event types must conform to the following regex: `^[a-zA-Z0-9_.-]{1,256}$`. <br/><br/>Each custom event, including metadata, must be less than 6 KB. Events over 6KB are dropped by CloudWatch RUM.
64
64
| registerDomEvents | Array | `cwr('registerDomEvents', [{ event: 'click', cssLocator: '[label="label1"]' }]);`<br/><br/>`awsRum.registerDomEvents([{ event: 'click', cssLocator: '[label="label1"]' }]);` | Register target DOM events to record. The target DOM events will be added to existing target DOM events. The parameter type is equivalent to the `events` property type of the [interaction telemetry configuration](https://github.com/aws-observability/aws-rum-web/blob/main/docs/cdn_installation.md#interaction).
65
-
| setAwsCredentials | [Credentials](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Credentials.html)\| [CredentialProvider](https://www.npmjs.com/package/@aws-sdk/credential-providers) | `cwr('setAwsCredentials', cred);`<br/><br/>`awsRum.setAwsCredentials(cred);` | Forward AWS credentials to the web client. The web client requires AWS credentials with permission to call the `PutRumEvents` API. If you have not set `identityPoolId`and `guestRoleArn`in the web client configuration, you must forward AWS credentials to the web client using this command.
65
+
| setAwsCredentials | [Credentials](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Credentials.html)\| [CredentialProvider](https://www.npmjs.com/package/@aws-sdk/credential-providers) | `cwr('setAwsCredentials', cred);`<br/><br/>`awsRum.setAwsCredentials(cred);` | Forward AWS credentials to the web client. The web client requires AWS credentials with permission to call the `PutRumEvents` API. If you have not set `identityPoolId` in the web client configuration, you must forward AWS credentials to the web client using this command.
66
66
67
67
## PageView
68
68
| Field Name | Type | Default | Example | Description |
@@ -73,7 +73,7 @@ The code snippet accepts six arguments. The snippet below shows these arguments
73
73
74
74
## Configuring the CloudWatch RUM web client
75
75
76
-
The application-specific web client configuration is a JavaScript object whose fields are all optional. While these fields are optional, depending on your application the web client may not function properly if certain fields are omitted. For example, `identityPoolId`and `guestRoleArn` are both required unless your application performs its own AWS authentication and passes the credentials to the web client using the command `cwr('setAwsCredentials', {...});`.
76
+
The application-specific web client configuration is a JavaScript object whose fields are all optional. While these fields are optional, depending on your application the web client may not function properly if certain fields are omitted. For example, `identityPoolId`is required unless your application performs its own AWS authentication and passes the credentials to the web client using the command `cwr('setAwsCredentials', {...});`.
77
77
78
78
The snippet below shows several configuration options with the body of the snippet's function omitted for readability:
79
79
```html
@@ -86,7 +86,6 @@ The snippet below shows several configuration options with the body of the snipp
Copy file name to clipboardExpand all lines: docs/cdn_troubleshooting.md
+16-11Lines changed: 16 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,10 +12,10 @@ configuration.
12
12
13
13
The web client requires AWS credentials to sign RUM payloads. When the RUM web
14
14
client does not have AWS credentials, it will not attempt to send events to
15
-
CloudWatch RUM. Your application must either (1) provide the web client with an
16
-
anonymous Cognito identity using `identityPoolId` and `guestRoleArn`, or (2)
17
-
provide the web client with AWS credentials using the `cwr('setAwsCredentials',
18
-
credentials);` command.
15
+
CloudWatch RUM. Your application must either (A) provide the web client with an
16
+
anonymous Cognito identity using `identityPoolId`, (B) provide the web client
17
+
with AWS credentials using the `cwr('setAwsCredentials', credentials);` command
18
+
or (C) use a proxy and disable SigV4 signing by setting `signing` to `false`.
19
19
20
20
### Event limit is reached for the session
21
21
@@ -142,7 +142,7 @@ following trust relationship:
142
142
143
143
### Cognito's basic authflow is not enabled
144
144
145
-
When the CloudWatch RUM web client is provided with both `identityPoolId` and `guestRoleArn`, the web client will use Cognito's [basic (classic) authflow](https://docs.aws.amazon.com/cognito/latest/developerguide/authentication-flow.html). If the Cognito `GetCredentialsForIdentity` operation fails, this may be because the basic (classic) authflow is not enabled for the identity pool. In this case, the response may look similar to the following:
145
+
When the CloudWatch RUM web client is provided with both `identityPoolId` and `guestRoleArn`, the web client will use Cognito's [basic (classic) authflow](https://docs.aws.amazon.com/cognito/latest/developerguide/authentication-flow.html). If the Cognito `GetCredentialsForIdentity` operation fails, this may be because the basic (classic) authflow is not enabled in the Cognito identity pool. In this case, the response may look similar to the following:
146
146
147
147
```
148
148
<Error>
@@ -152,15 +152,20 @@ When the CloudWatch RUM web client is provided with both `identityPoolId` and `g
152
152
</Error>
153
153
```
154
154
155
-
Using the Amazon Cognito console or CLI (i.e, the `aws cognito-identity
156
-
describe-identity-pool` command), verify that the identity pool
157
-
configuration does **not** contain `AllowClassicFlow: false`. If it does, then
158
-
update the configuration so that it contains `AllowClassicFlow: true`.
155
+
This can be fixed by removing `guestRoleArn` from the [web client
156
+
configuration](configuration.md). After removing `guestRoleArn`, the web client will use Cognito's [enhanced
Alternatively, to continue using the basic auth flow, use the Amazon Cognito
161
+
console or CLI (i.e, the `aws cognito-identity describe-identity-pool` command)
162
+
to verify that the identity pool configuration does **not** contain
163
+
`AllowClassicFlow: false`. If it does, then update the configuration so that it
164
+
contains `AllowClassicFlow: true`.
159
165
160
166
See also:
161
167
1.`AllowClassicFlow` in the [update-identity-pool CLI reference](https://docs.aws.amazon.com/cli/latest/reference/cognito-identity/update-identity-pool.html).
162
168
1.[Identity pool (federated identities) authentication flow](https://docs.aws.amazon.com/cognito/latest/developerguide/authentication-flow.html).
163
-
164
169
---
165
170
## Content security policy blocks the web client
166
171
@@ -184,7 +189,7 @@ web client will contain the following directives and values:
184
189
A hash of the snippet can be generated from the command line using openssl:
@@ -28,8 +27,8 @@ For example, the config object may look similar to the following:
28
27
| enableXRay | Boolean |`false`| When this field is `true`**and** the `http` telemetry is used, the web client will record X-Ray traces for HTTP requests.<br/><br/>See the [HTTP telemetry configuration](#http) for more information, including how to connect client-side and server-side traces. |
29
28
| endpoint | String |`'https://dataplane.rum.[region].amazonaws.com'`<br/><br/>`'https://[restapi_id].execute-api.[region].amazonaws.com/[stage_name]/'`| The URL of the CloudWatch RUM API where data will be sent.<br/><br/>You may include a path prefix like `/stage_name/` in the endpoint URL if there is a proxy between your web application and CloudWatch RUM. |
30
29
| eventPluginsToLoad |[Plugin](examples.md#record-custom-events-using-a-plugin)[]|`[]`| The set of custom plugins to load. See [usage examples](examples.md#record-custom-events-using-a-plugin). |
31
-
| guestRoleArn | String |`undefined`| The ARN of the AWS IAM role that will be assumed during anonymous authorization.<br/><br/>When this field is set (along with `identityPoolId`), the web client will attempt to retrieve temporary AWS credentials through Cognito using `AssumeRoleWithWebIdentity`. If this field is not set, you must forward credentials to the web client using the `setAwsCredentials` command. |
32
-
| identityPoolId | String |`undefined`| The Amazon Cognito Identity Pool ID that will be used during anonymous authorization.<br/><br/>When this field is set (along with `guestRoleArn`), the web client will attempt to retrieve temporary AWS credentials through Cognito using `AssumeRoleWithWebIdentity`. If this field is not set, you must forward credentials to the web client using the `setAwsCredentials` command. |
30
+
| guestRoleArn | String |`undefined`| The ARN of the AWS IAM role that will be assumed during anonymous authorization.<br/><br/>When `guestRoleArn` and `identityPoolId` are both set, the web client will use Cognito's [basic (classic) authflow](https://docs.aws.amazon.com/cognito/latest/developerguide/authentication-flow.html).<br/><br/>When only `identityPoolId`is set, the web client will use Cognito's [enhanced (simplified) authflow](https://docs.aws.amazon.com/cognito/latest/developerguide/authentication-flow.html) (recommended). |
31
+
| identityPoolId | String |`undefined`| The Amazon Cognito Identity Pool ID that will be used during anonymous authorization.<br/><br/>When `identityPoolId`is set, the web client will use Cognito to retrieve temporary AWS credentials. These credentials authorize the bearer to send data to the CloudWatch RUM app monitor.<br/><br/>When`identityPoolId`is not set, you must either (A) forward credentials to the web client using the `setAwsCredentials` command, or (B) use a proxy and set `signing` to `false`. |
33
32
| pageIdFormat | String |`'PATH'`| The portion of the `window.location` that will be used as the page ID. Options include `PATH`, `HASH` and `PATH_AND_HASH`.<br/><br/>For example, consider the URL `https://amazonaws.com/home?param=true#content`<br/><br/>`PATH`: `/home`<br/>`HASH`: `#content`<br/>`PATH_AND_HASH`: `/home#content`|
34
33
| pagesToInclude | RegExp[]|`[/.*/]`| A list of regular expressions which specify the `window.location` values for which the web client will record data, unless explicitly excluded by `pagesToExclude`. Pages are matched using the `RegExp.test()` function.<br/><br/>For example, when `pagesToInclude: [ /\/home/ ]`, then data from `https://amazonaws.com/home` will be included, and `https://amazonaws.com/` will not be included. |
35
34
| pagesToExclude | RegExp[]|`[]`| A list of regular expressions which specify the `window.location` values for which the web client will not record data. Pages are matched using the `RegExp.test()` function.<br/><br/>For example, when `pagesToExclude: [ /\/home/ ]`, then data from `https://amazonaws.com/home` will be excluded, and `https://amazonaws.com/` will not be excluded. |
0 commit comments