payload-plugin-newsletter 0.25.4 → 0.25.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [0.25.5] - 2025-08-18
2
+
3
+ ### Fixed
4
+ - Fixed "document not found" error when creating broadcasts by removing unnecessary update call during creation
5
+ - The afterChange hook now properly returns the modified document instead of trying to update it
6
+ - Added debug logging to help diagnose provider sync issues
7
+ - Ensures smooth broadcast creation without transaction conflicts
8
+
1
9
  ## [0.25.4] - 2025-08-18
2
10
 
3
11
  ### Fixed
@@ -2294,6 +2294,12 @@ var createBroadcastsCollection = (pluginConfig) => {
2294
2294
  if (!hasProviders) return doc;
2295
2295
  if (operation === "create") {
2296
2296
  try {
2297
+ req.payload.logger.info("Broadcast afterChange create hook - doc info:", {
2298
+ docId: doc.id,
2299
+ docIdType: typeof doc.id,
2300
+ hasDoc: !!doc,
2301
+ operation
2302
+ });
2297
2303
  const providerConfig = await getBroadcastConfig(req, pluginConfig);
2298
2304
  if (!providerConfig || !providerConfig.token) {
2299
2305
  req.payload.logger.error("Broadcast provider not configured in Newsletter Settings or environment variables");
@@ -2329,16 +2335,11 @@ var createBroadcastsCollection = (pluginConfig) => {
2329
2335
  hasActualContent: !!doc.contentSection?.content
2330
2336
  });
2331
2337
  const providerBroadcast = await provider.create(createData);
2332
- await req.payload.update({
2333
- collection: "broadcasts",
2334
- id: doc.id,
2335
- data: {
2336
- providerId: providerBroadcast.id,
2337
- externalId: providerBroadcast.id,
2338
- // Set externalId to match providerId for webhook lookup
2339
- providerData: providerBroadcast.providerData
2340
- },
2341
- req
2338
+ req.payload.logger.info("Provider broadcast created:", {
2339
+ providerBroadcastId: providerBroadcast.id,
2340
+ providerBroadcastIdType: typeof providerBroadcast.id,
2341
+ docId: doc.id,
2342
+ docIdType: typeof doc.id
2342
2343
  });
2343
2344
  req.payload.logger.info(`Broadcast ${doc.id} created in provider with ID ${providerBroadcast.id}`);
2344
2345
  return {