Example for Skygear Environment Variables


#1

Hi
Please Example for Skygear Environment Variables for push Notifications
this is my data my evn vars but doesn’t work
-APNS_ENABLE: “YES”
APNS_ENV: sandbox
APNS_TYPE: token
APNS_KEY_ID: xxxxxxxxx
APNS_TEAM_ID: xxxxxxxxx
APNS_TOKEN_KEY: -----BEGIN PRIVATE KEY-----
xxxxxxxxx
xxxxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxxxxx
-----END PRIVATE KEY-----
APNS_TOKEN_KEY_PATH: /AuthKey_xxxxxxxxxxxxxxx.p8
Thanks


#2

@KhaledAld

when APNS_TOKEN_KEY is specified, APNS_TOKEN_KEY_PATH will be ignored. We suggest you either using APNS_TOKEN_KEY or APNS_TOKEN_KEY_PATH. If you are using APNS_TOKEN_KEY_PATH, please make sure the file is put inside the docker container.


#3

Besides, if you are using APNS_TOKEN_KEY_PATH, APNS_TYPE should be cert


#4

@tentang Thanks for replay

now This is My variables :
APNS_ENABLE: -YES
APNS_ENV: sandbox
APNS_TYPE: token
APNS_KEY_ID: xxxxxxxxxxxx
APNS_TEAM_ID: XXXXXXXXXX
APNS_TOKEN_KEY: xxxxxxxxxxxxxxxxxxxxxxxxxxx

any wrong here ??
what’s the steps to enable push notifications on my local using docker ???

Thanks


#5

Hi @KhaledAld

We suggest using APNS_TOKEN_KEY_PATH when you are developing locally. Try using this configuration:

APNS_ENABLE: “YES”
APNS_ENV: sandbox
APNS_TYPE: token
APNS_KEY_ID: xxxxxxxxx
APNS_TEAM_ID: xxxxxxxxx
 APNS_TOKEN_KEY_PATH: /AuthKey_xxxxxxxxxxxxxxx.p8

Please note that when APNS_ENV is set to be sandbox, push notification only works in development build not distribution build.


#6

@tentang Thanks

I set configuration but still have the same error :

Optional(Error Domain=SKYOperationErrorDomain Code=10003 “An unexpected error has occurred.” UserInfo={NSErrorFailingURLKey=http://192.168.2.114:3001/push/user, SKYErrorMessage=Unable to send push notification because APNS is not configured or there was a problem configuring the APNS.

Note: I copped the key (.p8 file) to custom folder in Skygear server container
This is key (.p8 file) Path in Skygear server container : /app/data/cert/AuthKey_xxxxxxxxxxxx.p8

And this is server error :

app_1 | {“error”:{“name”:“UnexpectedPushNotificationNotConfigured”,“code”:10003,“message”:“Unable to send push notification because APNS is not configured or there was a problem configuring the APNS.\n”}}


#7

Hi @tentang
can you help me :roll_eyes: ??


#8

Hi @KhaledAld,

From your error message, it looks like the ios push cannot be enable correctly. The APNS_ENABLE seems using incorrect quote? It should be APNS_ENABLE: "YES" instead of APNS_ENABLE: “YES”. See if it works?


#9

It works fine :heart_eyes:
Thank you @carmenlau

Now can I add skygear-node to local?


#10

@KhaledAld I posted the example in another thread :smiley: