web-push icon indicating copy to clipboard operation
web-push copied to clipboard

util.inherits is not a function

Open 11003 opened this issue 9 months ago • 0 comments

NOTE: Please test in a least two browsers (i.e. Chrome and Firefox). This helps with diagnosing problems quicker.

Setup

Please provide the following details, the more info you can provide the better.

Operating System: <Windows> Node Version: <v20.13.1> web-push Version: <^3.6.7>

Please select any browsers that you are experiencing problems with:

  • [ - ] Chrome
  • [ - ] Firefox
  • [ - ] Opera for Android
  • [ ] Samsung Internet Browser
  • [ ] Other
async function onNotify1() {
	// VAPID keys should be generated only once.
	const webPush = await import('web-push')
	webPush.setGCMAPIKey('AIzaSyDNlm9R_w_0FDGjSM1fzyx5I5JnJBXACqU')
	// This is the same output of calling JSON.stringify on a PushSubscription
	const pushSubscription = {
		endpoint: '.....',
		keys: {
			auth: '.....',
			p256dh: '.....'
		}
	}

	webpush.sendNotification(pushSubscription, 'Your Push Payload Text')
}

image

11003 avatar May 28 '24 03:05 11003