@@ -397,7 +397,7 @@ export const handler = documentEventHandler<ContentDocument>(
397397 slug : `${ data . _type } -${ slug } ` ,
398398 tags : hashnodeTags ,
399399 ...( hashnodeCoverImageUrl
400- ? { coverImageOptions : { coverImageURL : hashnodeCoverImageUrl } }
400+ ? { coverImage : hashnodeCoverImageUrl }
401401 : { } ) ,
402402 originalArticleURL : canonicalUrl ,
403403 contentMarkdown : `Original: ${ canonicalUrl } \n\n${ youtubeEmbed } ${ contentMarkdown } ` ,
@@ -416,14 +416,16 @@ export const handler = documentEventHandler<ContentDocument>(
416416 existingSyndication ?. externalId || data . hashnode || null ;
417417
418418 let publishedPost : { id : string ; slug ?: string ; url ?: string } | null = null ;
419+ const authHeader = token . startsWith ( "Bearer " ) ? token : `Bearer ${ token } ` ;
419420
420421 if ( existingHashnodeSlug && ! existingHashnodeSlug . startsWith ( "simulated-" ) ) {
421422 // Lookup post ID from Hashnode
422- const getPostRes = await fetch ( "https://gql.hashnode.com" , {
423+ const getPostRes = await fetch ( "https://gql-beta .hashnode.com" , {
423424 method : "POST" ,
424425 headers : {
425426 "Content-Type" : "application/json" ,
426- Authorization : token ,
427+ Authorization : authHeader ,
428+ "x-hashnode-client" : "hashnode-cli" ,
427429 } ,
428430 body : JSON . stringify ( {
429431 operationName : "Publication" ,
@@ -445,11 +447,12 @@ export const handler = documentEventHandler<ContentDocument>(
445447 const updateInput = { ...articleInput } ;
446448 delete updateInput . slug ; // slug cannot be updated
447449
448- const updateRes = await fetch ( "https://gql.hashnode.com" , {
450+ const updateRes = await fetch ( "https://gql-beta .hashnode.com" , {
449451 method : "POST" ,
450452 headers : {
451453 "Content-Type" : "application/json" ,
452- Authorization : token ,
454+ Authorization : authHeader ,
455+ "x-hashnode-client" : "hashnode-cli" ,
453456 } ,
454457 body : JSON . stringify ( {
455458 operationName : "updatePost" ,
@@ -479,11 +482,12 @@ export const handler = documentEventHandler<ContentDocument>(
479482
480483 if ( ! publishedPost ) {
481484 // Create post mutation
482- const publishRes = await fetch ( "https://gql.hashnode.com" , {
485+ const publishRes = await fetch ( "https://gql-beta .hashnode.com" , {
483486 method : "POST" ,
484487 headers : {
485488 "Content-Type" : "application/json" ,
486- Authorization : token ,
489+ Authorization : authHeader ,
490+ "x-hashnode-client" : "hashnode-cli" ,
487491 } ,
488492 body : JSON . stringify ( {
489493 operationName : "publishPost" ,
0 commit comments