Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add uncachedEdgeURL to Blobs context #6461

Merged
merged 1 commit into from Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/lib/blobs/blobs.ts
Expand Up @@ -16,6 +16,7 @@ export interface BlobsContext {
edgeURL: string
siteID: string
token: string
uncachedEdgeURL: string
}

const printLocalBlobsNotice = () => {
Expand Down Expand Up @@ -58,11 +59,13 @@ interface GetBlobsContextOptions {
export const getBlobsContext = async ({ debug, projectRoot, siteID }: GetBlobsContextOptions) => {
const token = uuidv4()
const { port } = await startBlobsServer(debug, projectRoot, token)
const url = `http://localhost:${port}`
const context: BlobsContext = {
deployID: '0',
edgeURL: `http://localhost:${port}`,
edgeURL: url,
siteID,
token,
uncachedEdgeURL: url,
}

return context
Expand Down
5 changes: 4 additions & 1 deletion tests/integration/commands/dev/dev.config.test.js
Expand Up @@ -179,10 +179,13 @@ describe.concurrent('commands/dev/config', () => {

t.expect(NETLIFY_BLOBS_CONTEXT).toBeTypeOf('string')

const { deployID, edgeURL, siteID, token } = JSON.parse(Buffer.from(NETLIFY_BLOBS_CONTEXT, 'base64').toString())
const { deployID, edgeURL, siteID, token, uncachedEdgeURL } = JSON.parse(
Buffer.from(NETLIFY_BLOBS_CONTEXT, 'base64').toString(),
)

t.expect(deployID).toBe('0')
t.expect(edgeURL.startsWith('http://localhost:')).toBeTruthy()
t.expect(uncachedEdgeURL.startsWith('http://localhost:')).toBeTruthy()
t.expect(siteID).toBeTypeOf('string')
t.expect(token).toBeTypeOf('string')

Expand Down