caseybaggz
caseybaggz
SSolidJS
Created by DaOfficialWizard🧙 on 5/18/2024 in #support
Assistance with SolidStart and Supabase Auth in SSR
Happy to report that is appearing to fix the error!
25 replies
SSolidJS
Created by DaOfficialWizard🧙 on 5/18/2024 in #support
Assistance with SolidStart and Supabase Auth in SSR
I think I found the fix inspired by your response @peerreynders
setAll(cookiesToSet) {
const event = getRequestEvent();
if (!event?.nativeEvent.node.res.headersSent) {
cookiesToSet.forEach(({ name, value, options }) =>
event!.response.headers.set(
"Set-Cookie",
serializeCookieHeader(name, value, options),
)
);
}
},
setAll(cookiesToSet) {
const event = getRequestEvent();
if (!event?.nativeEvent.node.res.headersSent) {
cookiesToSet.forEach(({ name, value, options }) =>
event!.response.headers.set(
"Set-Cookie",
serializeCookieHeader(name, value, options),
)
);
}
},
I won't know until tomorrow when my session has expired so I'll keep you posted 😹
25 replies
SSolidJS
Created by DaOfficialWizard🧙 on 5/18/2024 in #support
Assistance with SolidStart and Supabase Auth in SSR
This is the error:
[❌] Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at ServerResponse.setHeader (node:_http_outgoing:699:11)
[❌] Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at ServerResponse.setHeader (node:_http_outgoing:699:11)
I have no idea how to check if headers have already been sent since getRequestEvent doesn't return the ol' Node headersSent prop 🤷‍♀️
25 replies
SSolidJS
Created by DaOfficialWizard🧙 on 5/18/2024 in #support
Assistance with SolidStart and Supabase Auth in SSR
I'm using this but it is currently crashing the app when it's time to refresh the token. Seems like there is another SS specific thing I'm missing?
import {
createServerClient,
parseCookieHeader,
serializeCookieHeader,
} from '@supabase/ssr';
import { getRequestEvent } from 'solid-js/web';
import { supabaseKey, supabaseUrl } from './index';

/**
* Create a server-side Supabase client.
*/
export function createClient() {
'use server';
return createServerClient<DB>(supabaseUrl, supabaseKey, {
cookieOptions: {
name: 'sb-auth-token',
},

cookies: {
getAll() {
return parseCookieHeader(
getRequestEvent()?.request.headers.get('Cookie') ?? '',
);
},
setAll(cookiesToSet) {
const event = getRequestEvent();
if (event?.response?.headers) {
cookiesToSet.forEach(({ name, value, options }) =>
event.response.headers.set(
'Set-Cookie',
serializeCookieHeader(name, value, options),
),
);
}
},
},
});
}
import {
createServerClient,
parseCookieHeader,
serializeCookieHeader,
} from '@supabase/ssr';
import { getRequestEvent } from 'solid-js/web';
import { supabaseKey, supabaseUrl } from './index';

/**
* Create a server-side Supabase client.
*/
export function createClient() {
'use server';
return createServerClient<DB>(supabaseUrl, supabaseKey, {
cookieOptions: {
name: 'sb-auth-token',
},

cookies: {
getAll() {
return parseCookieHeader(
getRequestEvent()?.request.headers.get('Cookie') ?? '',
);
},
setAll(cookiesToSet) {
const event = getRequestEvent();
if (event?.response?.headers) {
cookiesToSet.forEach(({ name, value, options }) =>
event.response.headers.set(
'Set-Cookie',
serializeCookieHeader(name, value, options),
),
);
}
},
},
});
}
25 replies
SSolidJS
Created by x_arthurx on 8/18/2023 in #support
efficient way of parsing markdown files with solidjs and solid-start
@thetarnav I'm using the same strat that you all are on the primitives site but for some reason I'm getting a build error for the dynamic imports?
Unknown variable dynamic import
Unknown variable dynamic import
The app.config.ts in the repo is so minimal, so I'm not sure why vinxi has a problem with it?
10 replies
SSolidJS
Created by caseybaggz on 3/22/2024 in #support
submit form without reloading
That definitely works but there is still a caveat that because it's an action it re-triggers any createResource .
15 replies
SSolidJS
Created by caseybaggz on 3/22/2024 in #support
submit form without reloading
Oh, interesting. throw void 0 looks like what i want exacly but how strange of a code read? Maybe I'll PR a new interface that is something like skipRevalidate or something? 🤔
15 replies
SSolidJS
Created by caseybaggz on 3/22/2024 in #support
submit form without reloading
OK - so you can use form just use the onSubmit and preventDefault with no action to not auto-reload the route.
15 replies
SSolidJS
Created by caseybaggz on 3/22/2024 in #support
submit form without reloading
I'm literally just doing what is on the README. But, I guess this was more about the philosophy of when to use form and actions in each use case? So, I've noticed if I don't use them, the route doesn't reload, so I'm guessing that when you want the magic of dynamically updating everything without having to keep track of it (like on a server) - then form/actions are your friend. But, when you need to keep a client side store and not refresh everything (i.e. realtime usage) - they are not your friend. I'm still guessing this is in response to the update in the Router to utilize the native form element? Maybe I'm missing something though?
15 replies
SSolidJS
Created by caseybaggz on 3/22/2024 in #support
submit form without reloading
revalidate doesn't seem to do anything as I've tried it every way I can think of? 🤷‍♀️
15 replies
SSolidJS
Created by caseybaggz on 3/14/2024 in #support
Does streaming work in SolidJS with signals?
I cannot outside of the example I have because it is a private code base
26 replies
SSolidJS
Created by caseybaggz on 3/14/2024 in #support
Does streaming work in SolidJS with signals?
Yeah, the code comes in chunks and not streaming. I feel like I read somewhere that signals defer for performance which I think it is the reason. The reproduction doesn't work fine though - should be loading very quickly at every 200ms (or whatever I put) but instead loads slower.
26 replies
SSolidJS
Created by caseybaggz on 3/14/2024 in #support
Does streaming work in SolidJS with signals?
Not sure how to really reproduce this since openAI is using an actual fetch stream (not the same as just faking it) but this is kind of what it is doing - but it still doesn't explain why the real deal logs fine in an effect but doesn't update in the rendered JSX like the example does? https://stackblitz.com/edit/solidjs-templates-3g8e9e?file=src%2FApp.tsx
26 replies
SSolidJS
Created by caseybaggz on 3/14/2024 in #support
Does streaming work in SolidJS with signals?
Oh, I wonder if I need to do something with this? 🤔 https://docs.solidjs.com/reference/rendering/render-to-stream
26 replies
SSolidJS
Created by caseybaggz on 3/14/2024 in #support
Does streaming work in SolidJS with signals?
Client
26 replies
SSolidJS
Created by caseybaggz on 3/14/2024 in #support
Does streaming work in SolidJS with signals?
Vanilla Solid
26 replies
SSolidJS
Created by caseybaggz on 3/14/2024 in #support
Does streaming work in SolidJS with signals?
26 replies
SSolidJS
Created by caseybaggz on 3/14/2024 in #support
Does streaming work in SolidJS with signals?
26 replies
SSolidJS
Created by caseybaggz on 3/14/2024 in #support
Does streaming work in SolidJS with signals?
Right. I guess what I'm asking is if there is anything particular in the signal/store logic that prevents streaming updates? I can log all day and it works but the UI will never re-render the signal even though an effect will log it correctly. So, I'm assuming there is something deeper in the "fine grain" details on the Solid side that is not so compatible with streaming updates?
26 replies
SSolidJS
Created by caseybaggz on 3/14/2024 in #support
Does streaming work in SolidJS with signals?
But wouldn't that defeat the purpose? If I remove the open ai stuff it's just an effect and signal update?
26 replies