Skip to content

Failed to generate token #2

@sanealytics

Description

@sanealytics

I'm not familiar with apn, and keep getting this error when I try to push it -

Invalid APN params { VError: Failed to generate token: error:0906D06C:PEM routines:PEM_read_bio:no start line
    at prepareToken (/Users/saurabh/Documents/react-native-ios-push-notifications-example/node_modules/apn/lib/credentials/token/prepare.js:45:13)
    at config (/Users/saurabh/Documents/react-native-ios-push-notifications-example/node_modules/apn/lib/config.js:43:31)
    at new Client (/Users/saurabh/Documents/react-native-ios-push-notifications-example/node_modules/apn/lib/client.js:11:19)
    at new Provider (/Users/saurabh/Documents/react-native-ios-push-notifications-example/node_modules/apn/lib/provider.js:12:19)
    at new Notification (/Users/saurabh/Documents/react-native-ios-push-notifications-example/pushServer.js:10:21)
    at Object.<anonymous> (/Users/saurabh/Documents/react-native-ios-push-notifications-example/pushServer.js:52:22)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
  jse_shortmsg: 'Failed to generate token',
  jse_cause:
   Error: error:0906D06C:PEM routines:PEM_read_bio:no start line
       at Sign.sign (internal/crypto/sig.js:84:26)
       at sign (/Users/saurabh/Documents/react-native-ios-push-notifications-example/node_modules/jwa/index.js:152:45)
       at Object.sign (/Users/saurabh/Documents/react-native-ios-push-notifications-example/node_modules/jwa/index.js:192:27)
       at Object.jwsSign [as sign] (/Users/saurabh/Documents/react-native-ios-push-notifications-example/node_modules/jws/lib/sign-stream.js:32:24)
       at module.exports (/Users/saurabh/Documents/react-native-ios-push-notifications-example/node_modules/jsonwebtoken/sign.js:204:16)
       at prepareToken (/Users/saurabh/Documents/react-native-ios-push-notifications-example/node_modules/apn/lib/credentials/token/prepare.js:27:18)
       at config (/Users/saurabh/Documents/react-native-ios-push-notifications-example/node_modules/apn/lib/config.js:43:31)
       at new Client (/Users/saurabh/Documents/react-native-ios-push-notifications-example/node_modules/apn/lib/client.js:11:19)
       at new Provider (/Users/saurabh/Documents/react-native-ios-push-notifications-example/node_modules/apn/lib/provider.js:12:19)
       at new Notification (/Users/saurabh/Documents/react-native-ios-push-notifications-example/pushServer.js:10:21),
  jse_info: {},
  message:
   'Failed to generate token: error:0906D06C:PEM routines:PEM_read_bio:no start line' }
/Users/saurabh/Documents/react-native-ios-push-notifications-example/pushServer.js:24
      throw new Error('No apn connection')
      ^

Error: No apn connection
    at Notification.sendNotification (/Users/saurabh/Documents/react-native-ios-push-notifications-example/pushServer.js:24:13)
    at Object.<anonymous> (/Users/saurabh/Documents/react-native-ios-push-notifications-example/pushServer.js:54:4)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:266:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:596:3)

I have ios_development.cer in the local directory and have checked the params again, but can't get this to work.... please help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions