Skip to content

Commit

Permalink
Fix function drafts not working during dev
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacroldan committed Dec 4, 2024
1 parent 38dc70c commit 73eb727
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/wicked-singers-explode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/app': patch
---

Fix function drafts not working during dev
6 changes: 4 additions & 2 deletions packages/app/src/cli/services/dev/update-extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,17 @@ export async function updateExtensionDraft({
// When updating just the theme extension draft, upload the files as part of the config.
config = await themeExtensionConfig(extension)
} else {
config = (await extension.deployConfig({apiKey, appConfiguration})) || {}
config = (await extension.deployConfig({apiKey, appConfiguration})) ?? {}
}

const draftableConfig: {[key: string]: unknown} = {
...config,
serialized_script: encodedFile,
}
if (extension.isFunctionExtension) {
const compiledFiles = await readFile(outputPath, {encoding: 'base64'})
// For function drafts we need to use the `extension.outputPath` instead of `bundlePath`
// The wasm in the bundle path is encoded in base64.
const compiledFiles = await readFile(extension.outputPath, {encoding: 'base64'})
draftableConfig.uploaded_files = {'dist/index.wasm': compiledFiles}
}
const extensionInput: ExtensionUpdateDraftMutationVariables = {
Expand Down

0 comments on commit 73eb727

Please sign in to comment.