Skip to content
Gx
GitHub

GX7002: gx.Secret cannot cross to the client

A gx.Secret value is used where the browser can read it: in a signal or in a client expression.

Cause

A gx.Secret value is used where the browser can read it: in a signal or in a client expression.

Example

cart/Cart.gx
package cart

import "github.com/alternayte/gx"

signals {
  Token gx.Secret = "key"
}

<p>Cart</p>

gx check reports:

gx check
cart/Cart.gx:6:3: GX7002: signal "Token" has type gx.Secret; a secret cannot cross to the client

Fix

  1. Keep the secret on the server.
  2. Pass to the browser only the result that the page needs.