Mango Juicy
Mango Juicy
Explore posts from servers
SSolidJS
Created by Mango Juicy on 10/14/2024 in #support
Cloudflare worker presigned url S3, R2
How do you generate presigned urls or S3 or R2... from cloudflare workers? Solution: Use aws4fetch package which is designed to work on cloudflare workers: https://developers.cloudflare.com/r2/examples/aws/aws4fetch/ Do not use @aws-sdk/s3-request-presigner as this depends on a @smithy package that requires node:fs, which is unsupported on Cloudflare. Calling a node:fs will result in a is not a function error PS: I've already found a solution. Though I'd put this here for anybody facing the same issue.
1 replies
SSolidJS
Created by Mango Juicy on 9/29/2024 in #support
Client side singleton for heavy resource allocation
Is there a way to create a global singleton for client side without initialising again on page loads? In my case, I'm preloading a synthesizer on the web, which takes time to load. Disabling SSR and using only client side routing for subroutes could work. But how would you do that?
2 replies
SSolidJS
Created by Mango Juicy on 8/15/2024 in #support
What is the timeout of 'use server' functions?
Context: I plan to use long polling in an app I couldn't find any documentation on how to control timeouts for server functions. How should this be handled?
9 replies
SSolidJS
Created by Mango Juicy on 8/6/2024 in #support
Precache service worker
Is there any way to implement service worker for content precaching? For context I'm creating a website with a midi player. It would be great to precache large (1 to 21 MB ish) SoundFont files. I've tried using VitePWA plugin in Vinxi. It doesn't appear to register any service workers though. app.config.ts:
import { defineConfig } from '@solidjs/start/config'
import { VitePWA } from 'vite-plugin-pwa'

export default defineConfig({
vite: {
...
plugins: [
VitePWA({
registerType: 'autoUpdate',
workbox: {
globPatterns: ['**/*.{ico,png,svg,jpg,webp,sf3,wasm}'],
},
}),
],
},
...
})
import { defineConfig } from '@solidjs/start/config'
import { VitePWA } from 'vite-plugin-pwa'

export default defineConfig({
vite: {
...
plugins: [
VitePWA({
registerType: 'autoUpdate',
workbox: {
globPatterns: ['**/*.{ico,png,svg,jpg,webp,sf3,wasm}'],
},
}),
],
},
...
})
19 replies
SSolidJS
Created by Mango Juicy on 8/2/2024 in #support
createAsync different values on client and server SSR issue
I'm trying to conditionally render components based on auth - think paywalled content. I have a server function that detects if user has logged in:
const _userLoggedIn = cache(async () => {
'use server'
const sessionData = await getSession()
const userId = sessionData.data.userId
if (userId) return true
return false
}, 'userLoggedIn')
const _userLoggedIn = cache(async () => {
'use server'
const sessionData = await getSession()
const userId = sessionData.data.userId
if (userId) return true
return false
}, 'userLoggedIn')
However, createAsync returns undefined leading nothing to be rendered on the server:
const userLoggedIn = createAsync(() => _userLoggedIn(), { deferStream: true })
console.log(userLoggedIn())
const userLoggedIn = createAsync(() => _userLoggedIn(), { deferStream: true })
console.log(userLoggedIn())
Server:
undefined
undefined
Client returns the expected value:
true
true
16 replies