#Node Http2 request to another origin

6 messages · Page 1 of 1 (latest)

modern badger
#

Does Cloudflare worker support request to outsource Http2 ?

  • I want to use node:http2 request to APNs
  import http2 from "node:http2"; //Cannot find module 'node:http2' or its corresponding type declarations.
  const session = http2.connect("https://api.sandbox.push.apple.com:443");
  • I see Cloudflare has fetch api in their own build but when making request the Network connection is lost for HTTP is work fine but error with HTTP2
haughty crystal
#

did you make it work?

modern badger
#

no

hearty fable
#

@modern badger @haughty crystal did any of you two figure this out?

haughty crystal
#

Fixed by using firebase

#

Like this: const response = await fetch(
https://fcm.googleapis.com/v1/projects/${env.FIREBASE_PROJECT_ID}/messages:send,
{
method: 'POST',
headers: {
Authorization: Bearer ${firebaseAccessToken},
Accept: 'application/json',
'Accept-encoding': 'gzip, deflate',
'Content-Type': 'application/json',
},
body: JSON.stringify(messageBody),
},
)