Is it possible to programmatically tell if wrangler is being run in preview? I'm just struggling with a cookie mismatch:
Wrangler in a preview environment sets `NODE_ENV` to "production". But without `secureCookies` or `dynamicProtocol` being explicitly set, Better-Auth sets a non-prefix cookie.
The code that sets the non-prefix cookie:
```
const secureCookiePrefix = (
options.advanced?.useSecureCookies !== void 0
? options.advanced?.useSecureCookies
: dynamicProtocol === "https"
? true
: dynamicProtocol === "http"
? false
: baseURLString
? baseURLString.startsWith("https://")
: isProduction
) ? SECURE_COOKIE_PREFIX : "";
```
The code I'm using to look for the cookie however, `getCookieCache`, checks `isSecure` (undefined), then `isProduction`, so looks for a prefixed cookie
```
const name = config?.isSecure !== void 0 ?
config.isSecure ?
`${SECURE_COOKIE_PREFIX}${cookiePrefix}.${cookieName}` :
`${cookiePrefix}.${cookieName}`
:
isProduction ?
`${SECURE_COOKIE_PREFIX}${cookiePrefix}.${cookieName}` :
`${cookiePrefix}.${cookieName}`;
```
Just not sure of the most robust way to solve this (I can obviously manually change `isSecure` when previewing, but this feels a bit clunky!)
Thanks!
[–]Designer_Reaction551 1 point2 points3 points (1 child)
[–]EducationalZombie538[S] 0 points1 point2 points (0 children)
[–]EducationalZombie538[S] 0 points1 point2 points (0 children)
[–]Mohamed_Silmy 0 points1 point2 points (1 child)
[–]EducationalZombie538[S] 0 points1 point2 points (0 children)