postiz-app icon indicating copy to clipboard operation
postiz-app copied to clipboard

Instagram Standalone Not Working

Open jrpetersjr opened this issue 7 months ago • 6 comments

📜 Description

Whenever I try to use instagram standalone no matter what I do I just get a page not found error:

Image

The domain (with my actual domain replaced with mydomain) that is in the address bar is:

https://www.instagram.com/oauth/authorize?enable_fb_login=0&client_id=undefined&redirect_uri=https%3A%2F%2Fpostiz.mydomain.com%2Fintegrations%2Fsocial%2Finstagram-standalone&response_type=code&scope=instagram_business_basic%2Cinstagram_business_content_publish%2Cinstagram_business_manage_comments&state=UwTIDv

👟 Reproduction steps

  1. Go to calendar
  2. Press Add Channel
  3. Click Instagram (standalone)
  4. Log into Instagram
  5. See error on screen

👍 Expected behavior

I should be able to connect postiz to any of my instagram accounts.

👎 Actual Behavior with Screenshots

Image

The above image shows.

💻 Operating system

Linux

🤖 Node Version

I do not have not node installed. I'm running this in Docker Compose.

📃 Provide any additional context for the Bug.

I'm running on Ubuntu Server running these on docker compose.

👀 Have you spent some time to check if this bug has been raised before?

  • [x] I checked and didn't find similar issue

Are you willing to submit PR?

Yes I am willing to submit a PR!

jrpetersjr avatar Apr 28 '25 05:04 jrpetersjr

I am also running into this issue

if I use the url from here

Image

I get this

Image

but If I just use the redirect URL by itself I also get the above not sure how to proceed

codetechninja avatar May 01 '25 00:05 codetechninja

Are you using it locally? You would need to use "https://redirectmeto.com/"

nevo-david avatar May 04 '25 03:05 nevo-david

Hey @nevo-david I am using it Locally, I will check that out thanks

codetechninja avatar May 11 '25 22:05 codetechninja

I too am running into an issue during add. Using a public server.

Application error: a server-side exception has occurred (see the server logs for more information).

The redirect URL is identical to expected.

https://postiz.example.com/integrations/social/instagram-standalone

If you try a different redirect URL (for testing) it throws a different error on the IG end.

` [0] 0|backend | {"error_type": "OAuthException", "code": 400, "error_message": "Error validating verification code. Please make sure your redirect_uri is identical to the one you used in the OAuth dialog request"} [0] 0|backend | node:internal/process/promises:389 [0] 0|backend | new UnhandledPromiseRejection(reason); [0] 0|backend | ^ [0] 0|backend | UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "#<RefreshToken>". [0] 0|backend | at throwUnhandledRejectionsMode (node:internal/process/promises:389:7) [0] 0|backend | at processPromiseRejections (node:internal/process/promises:470:17) [0] 0|backend | at process.processTicksAndRejections (node:internal/process/task_queues:96:32) { [0] 0|backend | code: 'ERR_UNHANDLED_REJECTION' [0] 0|backend | } [0] 0|backend | Node.js v20.18.1 [0] 3|frontend | TypeError: fetch failed [0] 3|frontend | at node:internal/deps/undici/undici:13392:13 [0] 3|frontend | at async /app/apps/frontend/.next/server/app/(app)/(site)/integrations/social/[provider]/continue/page.js:3:28327 [0] 3|frontend | at async il (/app/apps/frontend/.next/server/app/(app)/(site)/integrations/social/[provider]/continue/page.js:3:26990) { [0] 3|frontend | digest: '2679480868', [0] 3|frontend | [cause]: SocketError: other side closed [0] 3|frontend | at Socket. (node:internal/deps/undici/undici:6238:28) [0] 3|frontend | at Socket.emit (node:events:530:35) [0] 3|frontend | at endReadableNT (node:internal/streams/readable:1698:12) [0] 3|frontend | at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { [0] 3|frontend | code: 'UND_ERR_SOCKET', [0] 3|frontend | socket: { [0] 3|frontend | localAddress: '::1', [0] 3|frontend | localPort: 49054, [0] 3|frontend | remoteAddress: '::1', [0] 3|frontend | remotePort: 3000, [0] 3|frontend | remoteFamily: 'IPv6', [0] 3|frontend | timeout: undefined, [0] 3|frontend | bytesWritten: 1634, [0] 3|frontend | bytesRead: 0 [0] 3|frontend | } [0] 3|frontend | } [0] 3|frontend | } [0] 0|backend |  ELIFECYCLE  Command failed with exit code 1. [0] 0|backend |  WARN  Local package.json exists, but node_modules missing, did you mean to install? [0] PM2 | App [backend:0] exited with code [1] via signal [SIGINT] [0] PM2 | App [backend:0] starting in -fork mode- [0] PM2 | App [backend:0] online [0] 0|backend | > [email protected] start /app/apps/backend

`

john-penntech avatar May 28 '25 17:05 john-penntech

Did you manage to make this work? I tried adding the redirectmeto part in front of the redirect URL like so https://redirectmeto.com/<my_server_url> but it does not work either.

SuperMeepEnby avatar May 29 '25 12:05 SuperMeepEnby

Same issue

This are the error logs

0] 1|backend  | [Nest] 687  - 06/14/2025, 4:59:10 PM    WARN OpenAI API key not set, chat functionality will not work
[0] 1|backend  | [Nest] 687  - 06/14/2025, 4:59:10 PM   ERROR [ExceptionsHandler] Invalid state
[0] 1|backend  | Error: Invalid state
[0] 1|backend  |     at IntegrationsController.connectSocialMedia (/app/apps/backend/dist/apps/backend/src/api/routes/integrations.controller.js:207:19)
[0] 1|backend  |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[0] 1|backend  |     at async /app/node_modules/@nestjs/core/router/router-execution-context.js:46:28
[0] 1|backend  |     at async /app/node_modules/@nestjs/core/router/router-proxy.js:9:17
[0] 3|frontend |  ⨯ TypeError: fetch failed
[0] 3|frontend |     at node:internal/deps/undici/undici:13392:13
[0] 3|frontend |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[0] 3|frontend |     at async fetchExternalImage (/app/node_modules/next/dist/server/image-optimizer.js:600:17)
[0] 3|frontend |     at async NextNodeServer.imageOptimizer (/app/node_modules/next/dist/server/next-server.js:654:48)
[0] 3|frontend |     at async cacheEntry.imageResponseCache.get.incrementalCache (/app/node_modules/next/dist/server/next-server.js:182:65)
[0] 3|frontend |     at async /app/node_modules/next/dist/server/response-cache/index.js:90:36
[0] 3|frontend |     at async /app/node_modules/next/dist/lib/batcher.js:45:32 {
[0] 3|frontend |   [cause]: AggregateError [ECONNREFUSED]: 
[0] 3|frontend |       at internalConnectMultiple (node:net:1122:18)
[0] 3|frontend |       at afterConnectMultiple (node:net:1689:7)
[0] 3|frontend |       at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
[0] 3|frontend |     code: 'ECONNREFUSED',
[0] 3|frontend |     [errors]: [ [Error], [Error] ]
[0] 3|frontend |   }
[0] 3|frontend | }
[0] 1|backend  | [Nest] 687  - 06/14/2025, 4:59:20 PM    WARN OpenAI API key not set, chat functionality will not work
[0] 1|backend  | {"error":{"message":"Unsupported request - method type: get","type":"IGApiException","code":100,"fbtrace_id":"ATgTSMC_yOfpVdtkBU0ev0J"}}
[0] 1|backend  | {"error":{"message":"Unsupported request - method type: get","type":"IGApiException","code":100,"fbtrace_id":"AfZ8TOkC-bFCn5Y1R8zLvjt"}}
[0] 1|backend  | {"error":{"message":"Unsupported request - method type: get","type":"IGApiException","code":100,"fbtrace_id":"AGyzKOQ-gKb_ZfS3XpgfFhL"}}
[0] 1|backend  | node:internal/process/promises:389
[0] 1|backend  |       new UnhandledPromiseRejection(reason);
[0] 1|backend  |       ^
[0] 1|backend  | UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "#<BadBody>".
[0] 1|backend  |     at throwUnhandledRejectionsMode (node:internal/process/promises:389:7)
[0] 1|backend  |     at processPromiseRejections (node:internal/process/promises:470:17)
[0] 1|backend  |     at process.processTicksAndRejections (node:internal/process/task_queues:96:32) {
[0] 1|backend  |   code: 'ERR_UNHANDLED_REJECTION'
[0] 1|backend  | }
[0] 1|backend  | Node.js v20.18.1
[1] {"level":"error","ts":1749920366.3586402,"logger":"http.log.error","msg":"EOF","request":{"remote_ip":"192.168.155.1","remote_port":"37838","client_ip":"192.168.155.1","proto":"HTTP/1.1","method":"POST","host":"localhost:4000","uri":"/api/copilot/chat","headers":{"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36"],"Accept":["application/graphql-response+json, application/graphql+json, application/json, text/event-stream, multipart/mixed"],"Sec-Ch-Ua":["\"Google Chrome\";v=\"137\", \"Chromium\";v=\"137\", \"Not/A)Brand\";v=\"24\""],"X-Copilotkit-Runtime-Client-Gql-Version":["1.8.9"],"Sec-Fetch-Site":["same-origin"],"Content-Length":["209"],"Sec-Ch-Ua-Mobile":["?0"],"Sec-Fetch-Dest":["empty"],"Referer":["http://localhost:4000/integrations/social/instagram-standalone?code=TOKEN"],"Accept-Language":["en-US,en;q=0.9"],"Content-Type":["application/json"],"Origin":["http://localhost:4000"],"Accept-Encoding":["gzip, deflate, br, zstd"],"Connection":["keep-alive"],"Sec-Ch-Ua-Platform":["\"macOS\""],"Sec-Fetch-Mode":["cors"],"Cookie":[]}},"duration":5.969009869,"status":502,"err_id":"39cvnp4uh","err_trace":"reverseproxy.statusError (reverseproxy.go:1267)"}
[0] 3|frontend | TypeError: fetch failed
[0] 3|frontend |     at node:internal/deps/undici/undici:13392:13
[0] 3|frontend |     at async /app/apps/frontend/.next/server/app/(app)/auth/page.js:1:18949
[0] 3|frontend |     at async iu (/app/apps/frontend/.next/server/app/(app)/(site)/integrations/social/[provider]/continue/page.js:3:27033) {
[0] 3|frontend |   digest: '2813453293',
[0] 3|frontend |   [cause]: SocketError: other side closed
[0] 3|frontend |       at Socket.<anonymous> (node:internal/deps/undici/undici:6238:28)
[0] 3|frontend |       at Socket.emit (node:events:530:35)
[0] 3|frontend |       at endReadableNT (node:internal/streams/readable:1698:12)
[0] 3|frontend |       at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
[0] 3|frontend |     code: 'UND_ERR_SOCKET',
[0] 3|frontend |     socket: {
[0] 3|frontend |       localAddress: '::1',
[0] 3|frontend |       localPort: 59436,
[0] 3|frontend |       remoteAddress: '::1',
[0] 3|frontend |       remotePort: 3000,
[0] 3|frontend |       remoteFamily: 'IPv6',
[0] 3|frontend |       timeout: undefined,
[0] 3|frontend |       bytesWritten: 1661,
[0] 3|frontend |       bytesRead: 0
[0] 3|frontend |     }
[0] 3|frontend |   }
[0] 3|frontend | }
[0] 1|backend  |  ELIFECYCLE  Command failed with exit code 1.
[0] 1|backend  |  WARN   Local package.json exists, but node_modules missing, did you mean to install?
[0] PM2        | App [backend:1] exited with code [1] via signal [SIGINT]
[0] PM2        | App [backend:1] starting in -fork mode-
[0] PM2        | App [backend:1] online
[0] 1|backend  | > [email protected] start /app/apps/backend
[0] 1|backend  | > dotenv -e ../../.env -- node ./dist/apps/backend/src/main.js
[0] 1|backend  | [Nest] 737  - 06/14/2025, 4:59:27 PM     LOG [NestFactory] Starting Nest application...

Mohammed-Yasin-Mulla avatar Jun 14 '25 17:06 Mohammed-Yasin-Mulla

I am also running into this issue

if I use the url from here

Image

I get this

Image

but If I just use the redirect URL by itself I also get the above not sure how to proceed

I got this same screen when trying to connect an instagram account. After adding some console.logs to the back-end code, I discovered that the back-end makes an intermediate request to graph.instagram.com, which is a domain my DNS Adblocker happened to be blocking. After whitelisting this domain, connecting my Instagram account worked.

bitzerk avatar Jul 12 '25 20:07 bitzerk

I found the solution. I updated the .env file, but I also had to edit the Docker Compose file to include the missing .env variables.

In this case:

- 'INSTAGRAM_APP_ID=${INSTAGRAM_APP_ID}'
- 'INSTAGRAM_APP_SECRET=${INSTAGRAM_APP_SECRET}'

In Coolify, you can find these under "Edit Compose File".

enisbudancamanak avatar Aug 16 '25 01:08 enisbudancamanak

just change the OAuth redirect URIs on meta app

from https://postiz.example.me/integrations/social/instagram to https://postiz.example.me/integrations/social/instagram-standalone

KERMANEwalid avatar Oct 28 '25 19:10 KERMANEwalid

just change the OAuth redirect URIs on meta app

from https://postiz.example.me/integrations/social/instagram to https://postiz.example.me/integrations/social/instagram-standalone

This is the MVP comment right here. thank you!

four2theizz0 avatar Nov 03 '25 21:11 four2theizz0